如何提交具有多个不同的迭代值的html表单帖子? [英] How can I submit a html form post that has several different iterated values?

查看:53
本文介绍了如何提交具有多个不同的迭代值的html表单帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个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
or Path 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表单帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆