How to logout!!!

Thread Solved

Join Date: May 2008
Posts: 15
Reputation: samlabs821 is an unknown quantity at this point 
Solved Threads: 0
samlabs821's Avatar
samlabs821 samlabs821 is offline Offline
Newbie Poster

How to logout!!!

 
0
  #1
May 9th, 2008
  1. public class logout extends HttpServlet {
  2. public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  3. process(request,response);
  4. }
  5. public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  6. process(request,response);
  7. }
  8. public void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  9. HttpSession session = request.getSession();
  10. session.invalidate();
  11. response.sendRedirect("index.jsp");
  12. }
  13. }


session is still alive!!!
Last edited by peter_budo; May 9th, 2008 at 7:04 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to logout!!!

 
0
  #2
May 9th, 2008
no. But when you go to that JSP you immediately create a new session
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 15
Reputation: samlabs821 is an unknown quantity at this point 
Solved Threads: 0
samlabs821's Avatar
samlabs821 samlabs821 is offline Offline
Newbie Poster

Re: How to logout!!!

 
0
  #3
May 11th, 2008
can you give an example?
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 1
Reputation: rexlee84 is an unknown quantity at this point 
Solved Threads: 1
rexlee84 rexlee84 is offline Offline
Newbie Poster

Re: How to logout!!!

 
0
  #4
May 20th, 2008
well u could logout by using these methods
1) using the session.invalidate();
2) restricting the user from using the login details (when using the back button) by refreshing the page.
3) Using the sessionAccessTime.........

The first method does get you out of the session ............
provided you have used the session='true' [for jsp pages]
or HttpSession s=request.getSession(true) [in servlet this code works in the jsp in <% %>tag]
in the first page and using false in the rest of the pages as it wont create the new sessions..................

but this method is ineffective as the browser has a back button.................

if you want to know more about doing a proper logout you can write to me
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 1
Reputation: shardaprasad001 is an unknown quantity at this point 
Solved Threads: 1
shardaprasad001 shardaprasad001 is offline Offline
Newbie Poster

Re: How to logout!!!

 
0
  #5
Jun 29th, 2009
Originally Posted by rexlee84 View Post
well u could logout by using these methods
1) using the session.invalidate();
2) restricting the user from using the login details (when using the back button) by refreshing the page.
3) Using the sessionAccessTime.........

The first method does get you out of the session ............
provided you have used the session='true' [for jsp pages]
or HttpSession s=request.getSession(true) [in servlet this code works in the jsp in <% %>tag]
in the first page and using false in the rest of the pages as it wont create the new sessions..................

but this method is ineffective as the browser has a back button.................

if you want to know more about doing a proper logout you can write to me

I had read what you have discussed here. I am facing same problem what you had. If any suggestion or help that will be appreciated.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 15
Reputation: samlabs821 is an unknown quantity at this point 
Solved Threads: 0
samlabs821's Avatar
samlabs821 samlabs821 is offline Offline
Newbie Poster

Re: How to logout!!!

 
1
  #6
Jun 30th, 2009
Originally Posted by shardaprasad001 View Post
I had read what you have discussed here. I am facing same problem what you had. If any suggestion or help that will be appreciated.
  1. is to session.setAttribute(null,"sessionname");
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: itian_naeem is an unknown quantity at this point 
Solved Threads: 0
itian_naeem itian_naeem is offline Offline
Newbie Poster
 
0
  #7
32 Days Ago
session.invalidate(); will do the job.....we should have conditions to check if the session-attributes are present in every page except the login page....


or session.removeAttribute(); will also do the job...if you remove all the attributes...
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC