Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

forward problem in JSP

 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tony. I will check my JSP and will inform you about the progress.
regards
sankar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic