need more parameter in a page

I think that I post here is more suitable

Hello

In the jsp page that display list of books, I have:

<td>

<form action="<c:url value="book.html"/>">

<input type="hidden" name="id" value="<cut value="${book.bookId}"/>" /><input type="submit" name="edit" value="Edit" /></form>

</td>

When I click edit button for a book (with Id =1), I have this in URL:

http://localhost:8080/book/book.html?id=1&edit=Edit

This page will show the details of the book. As the book may have one or more comments and I need to update, delete any of these comments. To edit a comment with Id =2, I need to have one more parameter for it, example it is commentId = 2.

I tried:

<td>

<c:url var="editComment" value="book.html"> <!-- I need to display the edit comment in the same book detail page -->

<caram name="commentId" value="2"/>

</c:url>

<a href="<cut value="${editComment}"/>">edit Comment</a>

</td>

My URL now is http://localhost:8080/book/book.html?commentId=2

But I NEED to have this in URL:

http://localhost:8080/book/book.html?id=1&edit=Edit&commentId=2

Could you please tell me how to do this. I use a simpleFormController as all of actions happend on only one form.

Many thanks

shoa

[1424 byte] By [shoaa] at [2007-10-2 18:59:14]
# 1

Add another <c:param> tag in there.

<c:url var="editComment" value="book.html"> <!-- I need to display the edit comment in the same book detail page -->

<c:param name="id" value="${book.bookId}"/>

<c:param name="commentId" value="2"/>

</c:url>

Clicking on the link is a different request from clicking the submit button, so you need to send the id via the link as well.

Cheers,

evnafets

evnafetsa at 2007-7-13 20:37:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thank you for your help

<c:url var="editComment" value="book.html"> <!-- I need to display the edit comment in the same book detail page -->

<c:param name="id" value="${book.bookId}"/>

<c:param name="commentId" value="2"/>

</c:url>

It can be seen that the value "value="${book.bookId}"/>" is the value for the button in the first page(book list page) How I can get this value in the second page -the book details page...

sho

shoaa at 2007-7-13 20:37:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
at the least it will be available from the request parameters as ${param.id}" But you must do something with that id when you are loading the page. I presumed that there would still be a JSTL attribute "book" with the appropriate id.
evnafetsa at 2007-7-13 20:37:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...