This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get the value in a jsp page to the servlet

 
gayatri umesh
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//styleDetail.jsp



//ProductController.java



When i run the above code, a table is displayed with links. when i click on the link, the control is passed to the servlet 'ProductController' and i want to get the value of the link i have clicked.... If suppose the link clicked is 'ABC', this value should be read in the servlet..When i run the above code, the value of 'obj' is printed as 4 irrespective of any link i click in the jsp. Kindly help with a solution.....
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64183
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really not indent your code? It's unreadable as is.
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes very bad indentation...

anyway, you have an iterator object that is assigned to your obj Object as in the code below, and in your servlet you will get the last value in the list assigned in the internal loop.



ofcourse you are writing something wrong here, because in the loop you will keep overwrite the value of the parameter "value" in the session scope and in the end get the last value. if you want to know which link has been clicked you should add an (id) as a parameter in the link for example like this:




By the way I see you are using <%= %> and <% %> tags. try to avoid them as much as possible, and use EL and JSTL instead such as ${obj.id}
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


session is an one of the implicit object in jsp
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic