单击超链接时,将选定的信息从JSP发送到servlet

时间:2013-04-05 18:01:20

标签: java html jsp servlets jstl

我正在使用一个显示“节日名称”列表的JSP页面。然后,我想链接到点击页面,该页面将显示该节日的“个人资料页面”。我如何发送哪个链接被单击到JAVA SERVLET,以便我可以使用SQL和Java将所选信息发送到“配置文件页面”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上捕获它

1 个答案:

答案 0 :(得分:1)

使用链接

<a href="<c:url value="/servletpath"><c:param name="id" value="${festival.id}"/></c:url>">View Your Festivals</a>
相关问题