Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. 16 public class LogoutServlet extends HttpServlet
  2. 17 {
  3. 18
  4. 19 public void doGet (HttpServletRequest request , HttpServletResponse
  5. response )
  6. 20 throws ServletException , IOException
  7. 21 {
  8. 22
  9. 23 // Get the session object first!
  10. 24 HttpSession session = request .getSession ();
  11. 25
  12. 26 // invalidate
  13. 27 session .invalidate ();
  14. 28
  15. 29 // Send back the page
  16. 30 PrintWriter out = response .getWriter ();
  17. 31 response .setContentType ("text/html");
  18. 32 out.println ("<HTML><BODY>");
  19. 33 out.println ("<h2> Logout Complete </h2>");
  20. 34 out.println ("<hr>");
  21. 35 out.println ("Your session has been invalidated.");
  22. 36 out.println ("<hr>");
  23. 37 out.println ("Click here to <a href=/servlet/CounterServlet2>start
  24. again </a>");
  25. 38 out.println("</BODY ></HTML >");
  26. 39 }
  27. 40
  28. 41 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement