I'm trying to figure out how to get results from a database query to be displayed on a listed page and if the user wants to know more about the results they will click one of the dynamically generated items that is hyperlinked. This will then bring the user to a detail page where they can read more about the item.

Currently, I have used one of the JSTL objects to connect to my SQL Server database and produce the correct results into a data table onto the item listing page. However I'm not quite clear on how to make these results be hyperlinks that query the detail page.

I've done this hundreds of times in ASP.NET but to be honest I haven't the slightest clue on how to do this in JSP. Any pointers or references to tutorials would be much appreciated.

8 Years
Discussion Span
Last Post by UnforsakenX

Let's say you retrieved some books' name/title from the database and you want to print their name/title on the page, and still be a link.
You'll have to write something like this:

<a href=GetBook.jsp?book=<%= BookTitle[i]%> > <%=BookTitle[i]%> </a>

Hope that answers your question. If not, tell me, i can try to help you further.


thanks for your help. Your suggestion was helpful. I ended up using a slight variation since I'm using the JSTL data table

<h:outputLink value="ListingTerm.faces?term=#{vartermListing.NAME}">
   <h:outputText id="termName" value="#{vartermListing.NAME}" styleClass="outputText">
   </h:outputText>											</h:outputLink>
Votes + Comments
Nice to see someone using JSTL after all
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.