aspose file tools*
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "forward problem in JSP" Watch "forward problem in JSP" New topic
Author

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 ?
Thanks
sankar
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
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)%>
instead.


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.
regards
sankar
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: forward problem in JSP