<s:iterator value = "itmLst" status="row_id" var="itmLst" id="itmLst" >
<s:if test="#row_id.index % 2 == 0">
<tr class="yellow-bg">
</s:if>
<s:else>
<tr class="gray-bg">
</s:else>
<td class="label-left">
<s:property value="itemNo" />
<s:text name=":" />
<s:property value="itemName" />
</td>
<td class="label-left">
<s:textfield name = "itmLst.purDmys"
value = "%{itmLst[#row_id.index].purDmys}"
id = "purDmys%{#row_id.count}"
cssClass = "TCMask[##/##/####,dd/mm/yyyy] textfield-date-month"
maxLength = "10" />
</td>
<s:if test='itmLst.entCod == "T" || itmLst.entCod == "t"'>
<td class="label-left">
<s:textfield name = "itmLst.entDmys"
value = "%{itmLst[#row_id.index].entDmys}"
id = "entDmys%{#row_id.count}"
cssClass = "TCMask[##/##/####,dd/mm/yyyy] textfield-date-month"
maxLength = "10" />
</td>
</s:if>
<s:else>
<td class="label-left">
<s:text name="N/A" />
</td>
</s:else>
<td class="label-left"> <s:property value="itemStatus" /> </td>
<td class="label-left">
<s:textfield name = "itmLst.itemCost"
id = "itemCost%{#row_id.count}"
value = "%{itmLst[#row_id.index].itemCost}"
cssClass = "textfield-amount"
maxLength = "10" />
</td>
<td class="label-left">
<s:textfield name = "itmLst.itemDepr"
id = "itemDepr%{#row_id.count}"
value = "%{itmLst[#row_id.index].itemDepr}"
cssClass = "textfield-amount"
maxLength = "10" />
</td>
<td class="label-left"> <s:property value="depDmys" /> </td>
<td class="label-left"> <s:property value="sgDepAmt" /> </td>
<td class="label-left">
<s:select name = "itmLst.actionSel"
list = "#{ 'K':getText('Keep As It Is'),'M':getText('Update Modified Values') ,'D':getText('Delete Item') }"
theme = "simple" />
</td>
</tr>
<s:if test="#row_id.index % 10 == 0">
<tr align="center" >
<td colspan="9">
<s:submit key = "update"
cssClass = "ovalbutton"
method = "postItems" />
<s:submit key = "cancel"
cssClass = "ovalbutton"
id = "cancelBtn"
method = "cancel"/>
</td>
</tr>
</s:if>
</s:iterator>
答案 0 :(得分:1)
当从JSP提交到动作类时,除非您在JSP上命名了itmList[0].itemNo
,itmList[0].purDmys
等元素,否则列表将始终为空白。
您可以在迭代列表时分配这些名称。