목록이 있습니다. 사용자는 n 개의 항목 번호와 설명을 추가 할 수 있습니다.struts2 반복기를 사용하거나 arraylist를 초기화하십시오.
그가 먼저 추가 한 다음 두 번째를 추가하면 추가 버튼이 추가됩니다.
데이터를 배열에 저장하고 페이지로 리디렉션하여 다음 레코드를 얻으려는 호출 클래스를 제공하고 있습니다.
반복기를 사용할 때 텍스트 상자가 다시 추가됩니다.
반복기를 사용하지 않으면 액션 클래스를 방문 할 때마다 arraylist가 초기화됩니다.
나는 static.It가 도움이 사람이 텍스트 필드를 반복 ArrayList를 매번 initailize 또는 반복자를 사용하지없는 날 중 하나를 도움이 될 수 있습니다한다면 할 수 없습니다.
<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()" />
코드를 형식화하고 조치를 취하십시오. –
"iterator를 사용하고 텍스트 필드를 반복하지 마십시오."여기에 오지 않았습니다. 나의 이해에 따라 새 행을 추가하는 사용자는 목록에서 이전 값을 업데이트하고 문제가 있다는 점에서 무엇을 다시 표시 할 때. –