Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 7 votes, 3.71 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-23-2008, 06:19 PM   PM User | #1
tech99sri
New Coder

 
Join Date: Apr 2008
Posts: 17
Thanks: 10
Thanked 0 Times in 0 Posts
tech99sri is an unknown quantity at this point
session invalidate in logout

Hi ,
I am having a logout link when clicked it redirects to the login.jsp page.
I have to invalidate the session when the logout link is clicked. (I cannot have a logout.jsp page to invalidate the session there).

How can I invalidate the session.
If I want to do it in the bean how would I be able to do that ??
Please provide the code for invalidating the session (any way except for using the logout as a different jsp page), so that if a user logs out , he would not be able to directly enter the jsp page.

thanks
tech99sri is offline   Reply With Quote
Old 05-07-2008, 10:31 PM   PM User | #2
ricardoz
New to the CF scene

 
Join Date: Apr 2008
Location: Montevideo, Uruguay
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ricardoz is an unknown quantity at this point
If you cannot have the user navigate through a logout servlet or JSP page (which would seem as the easiest way), what you can do is set a parameter on the login.jsp page at session scope:

<% request.getSession().setAttribute("loggedIn", "no"); %>

and then set it to "yes" when the user successfully logs in. Then you should check on every page (maybe better using a filter on your web.xml) for the existance and correct value ("yes") of this parameter.
ricardoz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:23 AM.


Advertisement
Log in to turn off these ads.