Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get the JSP session object inside the servlet

Status
Not open for further replies.

abc73

Programmer
Apr 28, 2004
89
US
How can I get the JSP session object inside the servlet.

In my JSP page I am set up a session i.e.

Code:
session.setAttribute("Names",vector); //where vector contains the data

then I call the servlet from JSP i.e.
Code:
<img src="test.dep.evg.MyServlet">
now I want to get the session object inside the servlet service method and that's what I am doing
Code:
Vector v = (Vector)session.getAttribute("Names");
but it keeps on giving me null. How can I get the values set in the session object in JSP page accessible in the servlet.

Thanks
 
HttpSession session = request.getSession();

Are you absolutely sure that -

a) You are setting the "Names" object ?
b) The vector is not actually null ?

--------------------------------------------------
Free Database Connection Pooling Software
 
Yes I am sure everythiong is fine. Any ideas.
Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top