我试图用另一个JSP的文本框中的预填充值重定向我的一个JSP页面。我想在与$ {tempEvents.eventName}关联的特定链接之后填充第二个JSP中的整个列数据
第一个JSP代码:
<table id="table" align="center">
<c:forEach var="tempEvents" items="${events}">
<tr>
<td align="center">
<a href = "specificEvent" id ="linkId">${tempEvents.eventName}</a>
</td>
</tr>
</c:forEach>
</table>
第二个JSP:
<form action = "specificEventMethod" modelAttribute="event">
<table id="table" align="center">
<tr>
<td>Event Name: </td>
<td align="center">${event.eventName}</td>
</tr>
<tr>
<td>Event Date: </td>
<td align="center">${event.eventDate}</td>
<!-- <td><input type = "text" name = "event.eventDate" disabled/></td> -->
</tr>
<tr>
<td>Fund Collected: </td>
<td><input type = "text" name = "event.fundCollected" disabled/></td>
</tr>
<tr>
<td>Fund Used: </td>
<td><input type = "text" name = "fundUsed"/></td>
</tr>
<tr>
<td>Remaining Balance: </td>
<td><input type = "text" name = "remainingBalance" disabled/></td>
</tr>
<tr>
<td align="center"><input class="btn btn-default custom" type = "submit" value = "Save"/></td>
</tr>
</table>
</form>
答案 0 :(得分:0)
通过将锚的href建为-来通过url传递值-
<a href="http://www.example.com/Demo/2ndJSPPage?eventName="${tempEvents.eventName} />
然后在第二个jsp页面中将其获取为-
<p><%= request.getParameter("eventName") %></p>