aspose file tools*
The moose likes JSP and the fly likes passing a parameter without form - from jsp to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "passing a parameter without form - from jsp to servlet" Watch "passing a parameter without form - from jsp to servlet" New topic
Author

passing a parameter without form - from jsp to servlet

Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
Hello,
I have a JSP which displays Category names from DB. I want to click on a hyperlink of a Category & the next page will show the SubCategories under that category.

I am facing problem to pass the corresponding Category ID to the Servlet when it is clicked.

I tried using:it gets forwarded to the servlet before clicking on the link.

So is there any way of passing the parameter to the desired Servlet without submitting a form? or if there is no way without form, then what is the proper solution??

a lot of thanks in advance
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Well, you're using jsp:forward-what did you expect?

Why wouldn't you just create the href with the parameter?!
Han Jie
Greenhorn

Joined: Sep 24, 2010
Posts: 24
href here in your codes are not effected, in other words, you have no chance to use the href you have defined.
Han Jie
Greenhorn

Joined: Sep 24, 2010
Posts: 24
this FAQ entry Redirect Forward can solve your problem maybe
Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
Thanks for your reply.
I have omitted jsp:forward and used href with query string and this works :-D
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing a parameter without form - from jsp to servlet
 
Similar Threads
Error passing data from jsp to servlet
Can't pass changed beans values from one JSP page to another
When the jsp contacts the servlet for the first time in a session
How to pass a Post parameter using a link?
include a jsp within a jsp and passing a parameter