This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP session problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "JSP session problem" Watch "JSP session problem" New topic
Author

JSP session problem

Mukta Rao
Greenhorn

Joined: May 25, 2004
Posts: 3
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

Joined: Oct 12, 2000
Posts: 5093
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.


42
Manish Tiwari
Greenhorn

Joined: May 19, 2004
Posts: 5
Hi ,

It is because of implicit object "session" which is present automatically in jsp.
Mukta Rao
Greenhorn

Joined: May 25, 2004
Posts: 3
I think now I understand JSP sessions better..
Thanks a lot
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JSP session problem
 
Similar Threads
existed code in perl and need to enhance in jsp
Maintaining sessions between ASP & JSP
Apache Config Issue
Reg::Perl Sessions
retreiving parameter from another web page made in different language altogether