| Author |
Dynamic Links.
|
Alex Marks
Ranch Hand
Joined: Sep 12, 2005
Posts: 31
|
|
Hi Everyone, To make the question as easy to understand as possible,I just describle my situation. In my first JSP page, I create a link to database to derive a list of book name(it is not the problem), and I would like to make each book name in the list as a hyperlink to the second JSP page which display the description of that book. But I dont know how to generate the link from 1st JSP page to 2nd JSP page to display the desription. Just make it simple, the table has 2 columns, Book name and Book Description. Thank you very much for your help. I am looking for your reply soon! Thanks again!
|
Before I come here, I am confused about Servlet/JSP. Ater I come here, I am more confused about it, but in systematically.
|
 |
Satish Chilukuri
Ranch Hand
Joined: Jun 23, 2005
Posts: 266
|
|
Hi, While displaying your list of books, have the primary key of your Book table as a parameter in the link. Since you have mentioned that your table has only two columns, I assume that the name field is your primary key. <A href="description.jsp?id=${book.name}">${book.name}</A> Now in your second jsp, you have the primary key available as a request parameter. You can get its value and fetch the decsription from the table using this value as a key.
|
 |
Daniel Rhoades
Ranch Hand
Joined: Jun 30, 2004
Posts: 186
|
|
|
Easy peasy, here's one possible solution - when creating the link the the 2nd JSP do it like this 2nd.jsp?book=Moby%20Dick, then in the 2nd JSP get that request parameter and look it up in the database
|
Drinking more tea is the key...
|
 |
Alex Marks
Ranch Hand
Joined: Sep 12, 2005
Posts: 31
|
|
|
Very happy to see your replies, Thank you very much, Let me try your solutions now ! Thanks again !
|
 |
 |
|
|
subject: Dynamic Links.
|
|
|