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 Java Interview Guide this week in the Jobs Discussion 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: 3226
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
It's not a secret anymore!