单击超链接时,将所选信息从JSP发送到servlet [英] Sending chosen information from JSP to a servlet when a hyper link is clicked
本文介绍了单击超链接时,将所选信息从JSP发送到servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用一个显示节日名称列表的JSP页面。然后,我想要链接到点击页面上,该页面将显示该节日的个人资料页面。我怎么发送哪个链接被点击到JAVA SERVLET,以便我可以使用SQL和Java将选择的信息发送到profile pagejsp。
I'm using a JSP page that displays a list of "festival names". I want to then link to a page on click which will show the "profile page" of that festival. how do i send which link was clicked to the JAVA SERVLET so that i can use SQL and Java to send the chosen information to the "profile page" jsp.
<table border ="1">
<tr>
<td>Festival Name:</td>
<td>Location:</td>
<td>Start Date:</td>
<td>End Date:</td>
<td>URL:</td>
<td>List of Trips to </td>
</tr>
<c:forEach items="${allFestivals}" var="festival">
<tr>
<td>${festival.festivalName}</td>
<td>${festival.location}</td>
<td>${festival.startDate}</td>
<td>${festival.endDate}</td>
<td>${festival.URL}</td>
<td><a href="festival_profile.jsp">View Your Festivals</a></td>
^i have the festivals ID that can be sent with this link in the jsp
</tr>
</c:forEach>
我简单地需要知道如何将所选的节日ID发送回servlet,以便它可以生成配置文件JSP。编辑:以及如何在servlet上捕获它
I simple need to know how to send the chosen "festival" ID back to the servlet so it can generate the profile JSP. EDIT : and how to catch it on the servlet
推荐答案
使用链接
<a href="<c:url value="/servletpath"><c:param name="id" value="${festival.id}"/></c:url>">View Your Festivals</a>
这篇关于单击超链接时,将所选信息从JSP发送到servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文