Two Laptop Bag
The moose likes JSP and the fly likes Session Verification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Session Verification" Watch "Session Verification" New topic

Session Verification

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 265
Hello Ranchers!!
I'm using jsp and oracle for doing my project.. So when i got logged in.. i used to put the user name and password in the session..
for egs :
1)main page is index.jsp..

and the url for the following pages are
http://localhost:8080/test --> for index.jsp
and http://localhost:8080/test/main_menu_page.jsp

so when ever the users put the correct username and password..
then only they are able to see the main_menu_page.jsp

so i want to verify the session when the page is loading..

how to verify the session!! when the page is loading

ie., if a user comming and typing the url as http://localhost:8080/test/main_menu_page.jsp
and then pressing enter.. he has to redirect to the login page or index.jsp!!

so for that i want to check for the sessions first in all pages..
can u help me.. how to search for the session!!
if u can provide me code.. that is also ok!!

thanks in advance.


Aravind Pasad..
Sri Gnana
Ranch Hand

Joined: Apr 29, 2004
Posts: 166
1. To verify the correct user, in main menu page take the user name and password from the DB and store it. when you are passing the value from the login page, check with DB value. If its not equal then redirect it.

2. In your main menu page, check the session value. If its null then 'redirect' to login page.
[ May 18, 2006: Message edited by: Sri Gnana ]

Thanks & Regards
Sri Gnana
Everythings Programmed!...
I agree. Here's the link:
subject: Session Verification
It's not a secret anymore!