问题描述
这是一个Spring MVC项目.
This is a Spring MVC project.
因此,以下JSP
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<table>
<c:forEach items="${nameList}" var="studentList">
<tr>
<td><c:out value="${studentList.name}"/> ${studentList.regNo}</td>
</tr>
</c:forEach>
</table>
返回类似值
Ramu
Somu
Mamu
Komu
我想将每个值都作为发布网址,这样,如果用户单击任何一个链接,我都希望像下面的jsp代码一样提交
I want to make each value as a post url, so that, if the user clicks any one link, I would like to submit as like the following jsp code does
<form method="post" action="number" id="number">
<div style="text-align: center;" >
<input width="20" type="text" data-validation="numbers" id="regNo" name="regNo" size="30" maxLength="50" placeholder="Enter Register Number">
</div>
</form>
我不想做GET. 我怎样才能做到这一点?请帮助我.
I don't wanna do GET. How can I do this? Please help me.
推荐答案
使用此
<td><a href='www.xyz.com:port/number?regNo=${studentList.regNo}><c:out value="${studentList.name}"/> </a></td>
Use this
<td><a href='www.xyz.com:port/number?regNo=${studentList.regNo}><c:out value="${studentList.name}"/> </a></td>
和regNo
您可以在控制器中作为request
参数获得
或者 Path parameter
在您的控制器中,例如
And regNo
you can get as the request
parameter in controller
orPath parameter
in your controller like
<td><a href='www.xyz.com:port/number/${studentList.regNo}><c:out value="${studentList.name}"/> </a></td>
并相应地修改控制器的配置.
And modify your controller's configuration accordingly.
这篇关于如何提交具有多个不同的迭代值的html表单帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!