logout problem

Ads
 

logout problem

I am stuck in my application --- hope anyone can take me out of this...

the problem is -- when i logout , the user goes to logout.jsp (as simple), but when he presses back button , he again sees the page , where he has come from .. please get me out of this problem thanks.

View Answers

August 27, 2012 at 4:21 PM

Use session.invalidate() method to close the session.Here is an example.

1)login.jsp:

<html>

<head>

<title>User Login</title>
</head>
<br>
<body Bgcolor ="#0099cc"><hr><hr>

<form method="POST" action="action.jsp">
<p><b>UserName:</b> <input type="text" name="UserName" size="10"></p>
<p><b>Password:</b> &nbsp;&nbsp;<input type="Password" name="Password" size="10"></p>
<p><input type="submit" value="Submit" name="submit"><input type=
"reset" value="Reset" name="reset"></p><hr><hr>
</form>

</body>

</html>

2)action.jsp:

<%@page import="java.util.*" %>
<script>
function go() {
window.location.replace("logout.jsp",'window','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
self.close()
}
</script>
<%String str = request.getParameter("UserName");
session.setAttribute("UserName", request.getParameter("UserName"));%>
Welcome to <%= session.getAttribute( "UserName" ) %>
<% if (session.getAttribute("UserName").equals("")){%>
<a href="login.jsp"><b>Login </b></a>
<%}
else{%>
<a href="javascript:go()"><b>Logout</b></a>
<%}
%>

3)logout.jsp:

<%session.invalidate();%>
You have logged out. Please
<a href="a.jsp"><b>Login</b></a>

September 1, 2012 at 2:18 PM

thanks for the response...

can you please explain me -- what's actually happening in function go() ...?

Ads









Related Tutorials/Questions & Answers:
logout problem
logout problem  I am stuck in my application --- hope anyone can take me out of this... the problem is -- when i logout , the user goes... he has come from .. please get me out of this problem thanks.   Use
Logout?
Logout?  how to logout from a jsp page?   Hi to logout from Jsp Page.you should use session.invalidate() method. *khalidkhan
Advertisements
login and logout
login and logout   > > > > hi, > >... button with value logout > > and in the action i had given the home.jsp page. > > > > The problem is, when i am
login-logout
login-logout  how to do login and logout using session in php
php login and logout code
php login and logout code  Hi, Can anyone share there code for creating a user login and logout page in PHP?or any useful tutorial that can help to create a login and logout application in PHP.. Thanks in Advance
php session for login and logout
php session for login and logout  Session management code to create a login and logout session in PHP. Thanks
session management for login logout in php
session management for login logout in php  how to manage session for login and logout in php
problem with session.invalidate()
problem with session.invalidate()  i stuck by a line with "session.invalidate()", after user logout also by pressing the back button of the browser user is still able to navigate to his home page and able to view the session
login/logout operation
login/logout operation  how to do log in/out operations in jsp plz kindly send the steps leing behind this operation  
ModuleNotFoundError: No module named 'synpla-logout'
ModuleNotFoundError: No module named 'synpla-logout'  Hi, My... 'synpla-logout' How to remove the ModuleNotFoundError: No module named 'synpla-logout' error? Thanks   Hi, In your python
login/logout operation
login/logout operation  how to do log in/out operations in jsp plz kindly send the steps leing behind this operation  
How to disable browser back after logout - JSP-Servlet
page for logout and redirecting in login page. when i am clicking logout session... problem is, when i am clicking browser back button i can see my old visited pages data. I dont want to see my old visited pages after logout or expire the session
ModuleNotFoundError: No module named 'odoo10-addon-pos-quick-logout'
ModuleNotFoundError: No module named 'odoo10-addon-pos-quick-logout'  ...: No module named 'odoo10-addon-pos-quick-logout' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-pos-quick-logout' error
ModuleNotFoundError: No module named 'odoo9-addon-pos-quick-logout'
ModuleNotFoundError: No module named 'odoo9-addon-pos-quick-logout'  ...: No module named 'odoo9-addon-pos-quick-logout' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-pos-quick-logout' error
ModuleNotFoundError: No module named 'django-force-logout'
ModuleNotFoundError: No module named 'django-force-logout'  Hi, My... named 'django-force-logout' How to remove the ModuleNotFoundError: No module named 'django-force-logout' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo12-addon-pos-quick-logout'
ModuleNotFoundError: No module named 'odoo12-addon-pos-quick-logout'  ...: No module named 'odoo12-addon-pos-quick-logout' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-pos-quick-logout' error
ModuleNotFoundError: No module named 'odoo12-addon-pos-quick-logout'
ModuleNotFoundError: No module named 'odoo12-addon-pos-quick-logout'  ...: No module named 'odoo12-addon-pos-quick-logout' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-pos-quick-logout' error
JSP Login Logout Example
JSP Login Logout Example In this section we will discuss how to create a simple login and logout example. This section will describe you all the steps for creating a simple login and logout example. To create a simple login logout
jsp code for storing login and logout time to an account
jsp code for storing login and logout time to an account  I need simple jsp code for extracting and storing login and logout time in a database table..plz someone help me...   Please visit the following link: http
After Logout Back Button Should not work again
After Logout Back Button Should not work again  Hi deepak,, I am doing Login Page,.. IN That If Logout Then When I Click Logout Button It Should...")!= null){ //then show the logout button }else{ // show the login button
Logout if its not active for longer period in jsp
Logout if its not active for longer period in jsp  hi all, Please tell me how to log out the application if its not performing any activity... to automatic logout
Spring Security Logout
Spring Security Logout .style1 { margin-left: 40px; } In this section, you will learn about adding logout in Spring Security Application. Before... are not well aware of it. Following changes you should made to implement logout
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
Login/Logout With Session
Login/Logout With Session       In this section, we are going to develop a login/logout application with session...;/action> <action name="logout" class="net.roseindia.logoutAction" >
Should not logout after clicking the back/forward button
Should not logout after clicking the back/forward button  Hi all I have wrote a code for login now. User is able to login but after logging in when he clicks on the back button user automatically gets logged out. very next
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Problem with loginbean.jsp
Problem with loginbean.jsp  http://www.roseindia.net/jsp/loginbean.shtml - I am getting an error in loginbean.jsp.There is some error regarding .What is hello in this? Also in this example how
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
Problem with cookies
Problem with cookies  Hello All, i need jsp code for RememberMe module of login. i am facing problem with cookies. so please if any one could guide me please help and provide mme the exact code.   Please visit

Ads