• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP session problem  RSS feed

 
Mukta Rao
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am a Computer Science student and have done some projects in java and also familiar with CGI/Perl. I am also learning JSP servlets.
Now I am working in a project where I have to keep track of the logged person in a series of pages. As I knew CGI/perl session concept I am using the JSP sessions to do this.
I am able to set sessions in one JSP page and retrive them in other. But in the CGI/perl scripts I used to set a session. The next page will get this session ID either from cookie or from query string and then gets the required variable from the session file.
I wonder how the JSP file gets the session file to verify without the session ID. Please anyone help me to solve my this basic doubt.

Thanks
Mukta
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP will get the session for you automatically. Unlike in Perl you don't have to specifically get it from the request.
The JSP is compiled into a Java servlet the first time it is run, and the code to get the session from the request is generated for you at that time so you can just access the session as if it always existed.
That same code will also generate a new session for you if none exists, so that too you don't have to worry about.
 
Manish Tiwari
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

It is because of implicit object "session" which is present automatically in jsp.
 
Mukta Rao
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think now I understand JSP sessions better..
Thanks a lot
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!