GeeCON Prague 2014*
The moose likes JSP and the fly likes Session object in a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Session object in a JSP" Watch "Session object in a JSP" New topic
Author

Session object in a JSP

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi,

If there is a jsp page that has a page directive disabling a session..

then how will the user's session be tracked....during the browsing of the application...

i.e. earlier pages and subsequent pages from this page..

Thanks in advance,
Regards
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The session directive doesn't really 'disable' sessions.
It just instructs the JSP compiler not to generate code that would explicitly create a session in this JSPs generated servlet.

If any JSP, or servlet has code that calls getSession(), then a session object will be created and the application will track sessions.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Thanks Ben!!!
Chetan Chauhan
Greenhorn

Joined: Oct 03, 2006
Posts: 8
If you do not wish to use in-built Session features then you can use
either of the following two techniques

1. Use Hidden Fields
2. Use Cookies

Then there will be no need to write code for session tracking.
But ofcourse some different code has to be there to implement this.
 
GeeCON Prague 2014
 
subject: Session object in a JSP