This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes how to get values from session in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "how to get values from session in servlet" Watch "how to get values from session in servlet" New topic
Author

how to get values from session in servlet

Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
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


SCJP, SCJD
Preparing for SCWCD
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26200
    
  66

Vaishali,
What happens if you store the array of strings in the session and loop through that?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to get values from session in servlet
 
Similar Threads
Processing Radio Buttons in a Form/Servlet
getting form data
button x,y values
Retrieving data in session
Servlet Response for AJAX