• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing a parameter without form - from jsp to servlet

 
Shajid Johnny
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you're using jsp:forward-what did you expect?

Why wouldn't you just create the href with the parameter?!
 
Han Jie
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this FAQ entry Redirect Forward can solve your problem maybe
 
Shajid Johnny
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
I have omitted jsp:forward and used href with query string and this works :-D
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic