• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get values from session in servlet

 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I passed checkbox values from html to servlet and add in session attributes.

I have problem to display that values from session.

This code is for getting values from request parameter and store in session

paraName=(String)reqPara.nextElement();

session.setAttribute(paraName, request.getParameter(paraName)); // paraName is selectprod


Now I want to get values of selectprod from session

if I write
Object obj = session.getAttribute("selectprod");

it is showing length of selectprod 2 but i want to display those two values.

Please help me.

Thanks

Vaishali
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34974
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vaishali,
What happens if you store the array of strings in the session and loop through that?
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne

Instead of adding request parameter directly on session, first I saved in array and then getAttribute from session and its works.

thanks again
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic