从 jsp 检索多个同名输入到 struts
我想问当我使用 ACtionForm 单击 SAVE 按钮时,如何在 struts 中 Action 类的循环内检索 jsp 表单中的同名值,而不使用 request.getParameterValues("screenName") 。
下面是示例 jsp 代码,我想从循环内部检索名称“screenName”:
<form action="EditScreeningServlet" method="post">
<input type = "hidden" name ="applicantNumber" value="${infoObj.applicantNumber}" >
<table>
<c:forEach var="screen" items="${screenList}">
<input type = "hidden" name ="screenId" value="${screen.screenId}" >
<tr>
<td>Screen Type:  </td> <td>*<input type="text" value="${screen.screenName}" name="screenName" readonly ="true">*</td>
</tr>
<tr>
<td>Date: </td> <td><input type="text" value="${screen.screenDate}" name="screenDate" class="date"></td>
</tr>
<tr>
<td>Result: </td>
<td>
<select name = screenResult>
<option value="Pass" ${screen.screenResult == 'Pass' ? 'selected' : ''}>Pass</option>
<option value="Fail" ${screen.screenResult == 'Fail' ? 'selected' : ''}>Fail</option>
<option value="" ${screen.screenResult == '' ? 'selected' : ''}></option>
</select>
</td>
</tr>
<tr><td> </td><td>  </td></tr>
</c:forEach>
</table>
<input type="submit" class="saveButton" value="SAVE">
</form>
I would like to ask how to retrieve the values of the same name in a jsp form inside a loop to the Action class in struts without using the request.getParameterValues("screenName") when I click the SAVE button using the ACtionForm.
Here is the sample jsp code that I would like to retrieve the name "screenName" from the inside the loop:
<form action="EditScreeningServlet" method="post">
<input type = "hidden" name ="applicantNumber" value="${infoObj.applicantNumber}" >
<table>
<c:forEach var="screen" items="${screenList}">
<input type = "hidden" name ="screenId" value="${screen.screenId}" >
<tr>
<td>Screen Type:  </td> <td>*<input type="text" value="${screen.screenName}" name="screenName" readonly ="true">*</td>
</tr>
<tr>
<td>Date: </td> <td><input type="text" value="${screen.screenDate}" name="screenDate" class="date"></td>
</tr>
<tr>
<td>Result: </td>
<td>
<select name = screenResult>
<option value="Pass" ${screen.screenResult == 'Pass' ? 'selected' : ''}>Pass</option>
<option value="Fail" ${screen.screenResult == 'Fail' ? 'selected' : ''}>Fail</option>
<option value="" ${screen.screenResult == '' ? 'selected' : ''}></option>
</select>
</td>
</tr>
<tr><td> </td><td>  </td></tr>
</c:forEach>
</table>
<input type="submit" class="saveButton" value="SAVE">
</form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
或者您可以使用 ID 与
输入文本元素
绑定in
<form>
you can not get as array of input element but you can.OR you can use ID to bind with
input text element