• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

JSP session problem

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think now I understand JSP sessions better..
Thanks a lot
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic