?
Solved

Select and display data from a particular row

Posted on 2011-04-30
4
Medium Priority
?
408 Views
Last Modified: 2012-06-27
Hello guys....trying to get good understanding of various topics in JSP...I have developped a search engine for my library website.The result of the search will be forwarded to a page which will then display them as a table.The code of that is:
<table border="1">
<th>BookTitle</th>
<th>Author</th>

<c:forEach items="${booksList.rows}" var="rows">
<tr>
<td><c:out value="${rows.BookTitle}" /></td>
<td ><c:out value="${rows.Author}" /></td>
<td><a href="reserve_book.jsp"><u> reserve</u></td>
</tr>
</c:forEach>
</table>

Open in new window


The output will be like :

The following books were found:
BookTitle                          Author
Business Strategy      Joe Peppard       reserve
Business book       Joe english       reserve
xxxxxxxxxxx          xxxxxxxx         reserve

As you can clearly see, the user can then click on reserve to reserve the book. What i want for the moment is a confirmation page that will display the data of the row selected( click reserve), if the user confirmed, another page will then insert the BookTitle and Author in a database( at this stage, i am sure i could that)....

I have tried to use things like:

: <c:out value="${param.BookTitle}"/> to get the value of the book title selected, but it is not working and i think it is not the way to go about it...

Thanks in advance



Search by book category
0
Comment
Question by:ozzyfanta
  • 2
  • 2
4 Comments
 
LVL 92

Assisted Solution

by:objects
objects earned 800 total points
ID: 35498859
you need to pass the book detailks as request param
for example if you have a row id

<td><a href="reserve_book.jsp?id=${rows.id}"><u> reserve</u></td>

you can then lookup the book in the reserve_book page using the id passed
0
 
LVL 92

Expert Comment

by:objects
ID: 35498861
if you just want to pass the title then make sure the url params are encoded correctly
0
 
LVL 28

Accepted Solution

by:
rrz earned 1200 total points
ID: 35498879
What web server are you using ?
If you are using a recent version, then you should be able to use
<table border="1">
<th>BookTitle</th>
<th>Author</th>
<c:forEach items="${bookList.rows}" var="rows">
<tr>
<td>${rows.BookTitle}"</td>
<td >"${rows.Author}</td>
<td><a href="reserve_book.jsp?BookTitle=${rows.BookTitle}&Author=${rows.Author}"><u> reserve</u></td>
</tr>
</c:forEach>
</table>

Open in new window

and in reserve_book.jsp  you should be able to use  
Title is ${param.BookTitle} and Author is ${param.Author}

Open in new window

0
 
LVL 28

Expert Comment

by:rrz
ID: 35498895
objects has a good idea in using the <c:url> and <c:param> tags.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video teaches viewers about errors in exception handling.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month15 days, 21 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question