简体   繁体   中英

Sending chosen information from JSP to a servlet when a hyper link is clicked

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>

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM