my dog learned polymorphism*
The moose likes JSP and the fly likes Help Regarding about Session in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Help Regarding about Session in jsp" Watch "Help Regarding about Session in jsp" New topic
Author

Help Regarding about Session in jsp

Santhana Lakshmi.S
Ranch Hand

Joined: Aug 16, 2005
Posts: 82
hi

I am developing one web page in jsp. here i have some doubt in session tracking for all pages.

can u tell me proper use of session tracking in all web pages.for example if u would like to use of username with all pages.

how to use this username account in session tracking without reflecting another username account datas.

thanks a lot
Santhosh Kumar
Ranch Hand

Joined: Nov 07, 2000
Posts: 242
Sorry that I'm not getting what is your doubt in the session tracking. Nevertheless I try what I can answer.

First of all, you seem very new to the Web application development. Eventhough friends here at javaranch are friendly enough to answer your questions, I would strongly suggest you to read a generic book on web application development which would explain very clearly.

To implement session for sets of pages:

1. Before accessing every page, check if there is a active session
2. If session is not there, redirect to login page
3. After user submits the login name/password, validate and create a session
4. Show the page.

In jsp you can just use the session variable to access the current session. Note that if there was no session for a user, system would automatically creates one. So to check if user logged in or not, you should check for some predefined value is stored in the session or not.

(If you session session="false" in the page directive, then jsp engine would not create a session varialbe. Then you can use the request.getSession(false) or request.getSession(true)) methods to control the session.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help Regarding about Session in jsp
 
Similar Threads
reseting jsp variables
Session persist when server shuts down?
Session problem
session tracking in jsps using cookies
What Is the Proper Place To Create A Session Object?