File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes how to do LOGOUT with servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to do LOGOUT with servlet" Watch "how to do LOGOUT with servlet" New topic

how to do LOGOUT with servlet

Yi Meng
Ranch Hand

Joined: May 07, 2003
Posts: 270
say i have basic authentication for some resources.
the user first has to login, no problem. But what if the user wants to logout? The desired should be that the user can still view other non-protected web pages and if the user wants to view those protected pages, it should prompt the user to login again. How to do this?

Meng Yi
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33131

It depends on how you are doing the authentication. If you are doing it yourself, you can put something in the session when they login successfuly. When they logout, delete that from the session. They can still look at other pages. If they try to look at a protected page, it will look for that value in the session and reprompt them.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: how to do LOGOUT with servlet
It's not a secret anymore!