JSP 迭代器中的Struts2行更新

omtl5h9j  于 2024-01-04  发布在  其他
关注(0)|答案(1)|浏览(272)

我在Employee.jsp中通过迭代器显示我的List,如图所示

Employee.jsp

  1. <thead>
  2. <tr >
  3. <td class=trusteditems>PFNO</td>
  4. <td class=trusteditems>Employee Name</td>
  5. <td class=trusteditems>Category</td>
  6. <td class=trusteditems>Password</td>
  7. <td class=trusteditems>Depot Code</td>
  8. </tr>
  9. </thead>
  10. <s:iterator value="employelist" var="employemaster" status="status">
  11. <tr >
  12. <td><s:radio name="selectedCode" list="{#status}" value=""/></td>
  13. <td><s:textfield disabled="true" value="%{pfno}" size="15" name="pfno"
  14. style="text- transform: uppercase" maxlength="8" theme="simple"/></td>
  15. <td><s:textfield disabled="true" value="%{name}" size="15" name="name" maxlength="8"
  16. theme="simple"/></td>
  17. <td><s:textfield disabled="true" value="%{type}" size="15" name="type"
  18. maxlength="8" theme="simple"/></td>
  19. style="text-transform: uppercase" maxlength="8" theme="simple"/></td>
  20. <td><s:textfield disabled="true" value="%{depocode}" size="15" name="depocode"
  21. style="text-transform: uppercase" maxlength="8" theme="simple"/></td>
  22. <td><s:submit/></td>
  23. <td></td>
  24. </tr>
  25. </s:iterator>

字符串
我最后添加了一个提交按钮。我希望这个提交按钮将特定行带到Update .jsp页面进行更新。在单击特定行中的提交时,我希望该特定行带到另一个名为Update .jsp的jsp

bprjcwpo

bprjcwpo1#

您不能将它们提交给action,因为您需要s:form tag。它应该Map到将处理提交的字段并返回Update.jsp结果的action。
如果使用索引属性名从提交的结果中筛选选定的行(如name="employeList[%{#status.index}].pfno"),效果会更好。
确保正确配置了Struts type conversion,以允许填充bean集合。

相关问题