I have a List. The user can add n item number and description.
He will add first and then to add second will press add more button .
I am giving a call to action class storing the data in array and redirecting back to the page to get the next record.
When I am using the iterator the text boxes are getting added again.
If I dont use iterator my arraylist is getting initailized everytime I visit the action class.
I cannot make it static.It will helpful if anyone can help me either to not initailize the arraylist everytime or use iterator and not repeat the textfields.
<table>
<tr align="center">
<s:iterator value="preAdviceDetailsDO" id="preAdviceDetailsDO" status="outerStat">
<s:if test="#outerStat.may be some useful word like even odd first == true">
<td style="background: #CCCCCC">
<s:textfield value="%{itemNumber}" name="preAdviceDetailsDO[%{#outerStat.index}].itemNumber" onblur="checkBarcode();"/>
</td>
<td style="background: #CCCCCC">
<s:textfield value="%{itemDescription}" name="preAdviceDetailsDO[%{#outerStat.index}].itemDescription"/>
</td>
</s:if>
</s:iterator>
</tr>
</table>
<input type="button" value="Add More" onclick="addRow()" />