This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes forward problem in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "forward problem in JSP" Watch "forward problem in JSP" New topic

forward problem in JSP

Sankar Subbiramaniam
Ranch Hand

Joined: Oct 03, 2000
Posts: 116
Hi Helpers,
I have a problem in accessing the session data in my JSP. The actual session is created by a servlet. Then after validation, forwards this to a jsp page. In this jsp page, i am not able to access the data stored in session object. I believe a new session is getting created.
(Interestingly, when this JSP in turn invokes another servlet, i am able to acces the same session object created in the first servlet).
Can somebody help in this ?
Tony Alicea

Joined: Jan 30, 2000
Posts: 3222
Make sure you are NOT using the session object in declarations like
<%! session.getValue(MY_KEY)%>
That won't work because the implicit objects are LOCAL variables of the service() method of the generated servlet.
You have to use
<% session.getValue(MY_KEY)%>

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Sankar Subbiramaniam
Ranch Hand

Joined: Oct 03, 2000
Posts: 116
Thanks Tony. I will check my JSP and will inform you about the progress.
I agree. Here's the link:
subject: forward problem in JSP
Similar Threads
Session data
sending session object from servlt-multiple jsp's
Communication session , servlet applet and back from applet servlet and session
servlets + jsp
getting session value in JSP