943,627 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Marked Solved
  • Views: 481
  • JSP RSS
Jul 17th, 2009
0

Question on dynamic hyperlinking

Expand Post »
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.
Similar Threads
Reputation Points: 31
Solved Threads: 0
Newbie Poster
UnforsakenX is offline Offline
2 posts
since Oct 2008
Jul 17th, 2009
0

Re: Question on dynamic hyperlinking

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:
JSP Syntax (Toggle Plain Text)
  1. <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.
Last edited by Alex_; Jul 17th, 2009 at 11:04 am.
Reputation Points: 10
Solved Threads: 3
Junior Poster
Alex_ is offline Offline
175 posts
since Jun 2008
Jul 17th, 2009
1

Re: Question on dynamic hyperlinking

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

JSP Syntax (Toggle Plain Text)
  1. <h:outputLink value="ListingTerm.faces?term=#{vartermListing.NAME}">
  2. <h:outputText id="termName" value="#{vartermListing.NAME}" styleClass="outputText">
  3. </h:outputText> </h:outputLink>
Reputation Points: 31
Solved Threads: 0
Newbie Poster
UnforsakenX is offline Offline
2 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: how to let servlet sends responds to an e-mail
Next Thread in JSP Forum Timeline: Submitting a form as the "content" of a email





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC