Hi friends,
I am trying to develop a web application in which I have provided a facility for login and logout. I can allow user to log in succesfully, but when user clicks on the logout link and comes to login page and after that if he presses the browser's BACK button, he is directed to the previous page.I don't want to use any javascript function like history(). please provide some sample code of one or 2 pages.please????

When you login, put the user name into the session: session.setAttribute("USERNAME", <username_of_the_user>); When you log out remove it: session.setAttribute("USERNAME", null); And in every page take the USERNAME from the session and check if it's null. If it is then who ever went to that page hasn't login:

<%
String username = (String)session.getAttribute("USERNAME");
if (username==null) {
%>
  // redirect to login page with message
<%
}
%>

but if my browser is set to remember the username and password, then will it work???

The browser remembers the password when you try to login. It will not keep you logged in. And it remembers the password only at the computer that you saved it.
When you logout with the above code you will not be allowed to proceed unless you login again.
Of course it is unwise to save your password at a browser/computer that many people use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.