Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet how to prevent from navigating Back after logout or session expire in jsp
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


vikas pandey
how to prevent from navigating Back after logout or session expire in jsp
1 Answer(s)      2 years ago
Posted in : JSP-Servlet


Hii Sir, I am making a web app in which after logout one can go to back pages from the browsers back button which i dont want in my app.

Plz sir give me the desired code to solve this issue and plz specify where to use it

either in every page of in login page or at logout page.

Thank you Sir


Advertisement
View Answers

September 10, 2012 at 5:44 PM


Check out here for your requirement.

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>   <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="login.jsp"><b>Login</b></a>


Related Tutorials/Questions & Answers:
how to prevent from navigating Back after logout or session expire in jsp
how to prevent from navigating Back after logout or session expire in jsp  Hii Sir, I am making a web app in which after logout one can go to back pages from the browsers back button which i dont want in my app. Plz
How to prevent from navigating to a page after reaching Login page using back button?
How to prevent from navigating to a page after reaching Login page using back... login page using back button and agin click browser forward button,the 2nd page session gets expired but on next click on forward button,the pdf document opens
Advertisements
How to disable browser back after logout - JSP-Servlet
How to disable browser back after logout  Dear All I created JSP... data. I dont want to see my old visited pages after logout or expire the session. Anyone having idea how to disable browser back button after logout, please
Session expire and back button in jsp and servlet .
Session expire and back button in jsp and servlet .  Hii Sir... to invalidate the session after a certain interval of time and after clicking logout button.Means that after session expiry time and logout action no one can access
How to prevent from navigating to ck buttonnext page when user reaches login page using back button
How to prevent from navigating to ck buttonnext page when user reaches login page using back button  Hi sir, I have created 2 pages, 1) Lo gin Page... goback to user login page using back button and agin click browser forward button
How to disable browser back and forward button after logout [in struts2 or jsp]
How to disable browser back and forward button after logout [in struts2 or jsp]  How to disable browser back and forward button after logout [in struts2 or jsp] I am using window.history.forward(); function
How to disable browser back after logout - JSP-Servlet
How to disable browser back after logout  thanks deepak, i tried but if i am clicking back still i can see my old pages. i copied your code in my logout page. please if you have any other solution, please give me
how can we prevent back option after log out.
how can we prevent back option after log out.  how can we prevent back option after log out
after logout the page is going back - Java Beginners
after logout the page is going back  Dear friends can any one help me urgently, how to restrict our jsp pages from going back after logout. i 've did... give details "How to logout the page" to solve the problem. Thanks
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... be creating session and adding some attribute during login process of user. Please
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
how to design a jsp page via link which will expire after 3 days if not use?
how to design a jsp page via link which will expire after 3 days if not use?   Link is in a mail and if changes occur it will update in database
how to design a jsp page via link which will expire after 3 days if not use?
how to design a jsp page via link which will expire after 3 days if not use?   Link is in a mail and if changes occur it will update in database
Session Expire
Session Expire  Hello... i am new in JSP. i use in session.setAttribute and .getAttribute.But when i click on the sign out button i shows that the user is sign out but when i click on back button(chrom back button) it is again
session syntax for logout - JSP-Servlet
given JSP code that will help you to logout from the application...session syntax for logout  What is the syntax for writing session for logout page in login services ?  Hi friend<%@page import="
how to disable back button of a browser after logging in? - JSP-Servlet
how to disable back button of a browser after logging in?  how to disable back button of a browser after logging in?  where is the source code
How to revert back ServletInputStream object after reading once. - JSP-Servlet
How to revert back ServletInputStream object after reading once.  Hi All, I am trying to get parameter from request object which is multipart/form.... My Q is how can I iterate request object twice? How we can revert back
How to Auto Delete Bids after certail time expire.?
How to Auto Delete Bids after certail time expire.?  I am developing alibaba.com like website where after time expires ,buying request need to be deleted. So is there any idea experts have for this type of problem
How to Auto Delete Bids after certail time expire.?
How to Auto Delete Bids after certail time expire.?  I am developing alibaba.com like website where after time expires ,buying request need to be deleted. So is there any idea experts have for this type of problem
session cookies expire - PHP
session cookies expire  when do a session cookies expire in PHP
how to prevent no from unroundin off on clicking text box again in JSP and Jquery
how to prevent no from unroundin off on clicking text box again in JSP and Jquery  I am rounding off numbers entered in a text box in jsp but when I... on clicking outside It rounds off again, How can i prevent it from un-rounding off
session maintaining after logged in in jsp
session maintaining after logged in in jsp  Hi. I have created a login page. after the user logged in successfully if the user gives refresh the the control goes to the website home page. i want to retain in the same page
how to prevent user selecting past date from calender
how to prevent user selecting past date from calender  how to prevent user selecting past date from calender ex: today's date is 21st march user should not select 20th march or below
session management for login logout in php
session management for login logout in php  how to manage session for login and logout in php
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
logout problem.. - JSP-Servlet
done in the code i have used session object in project's servlet and jsp...(M.V.C),when a user login's and after doing some work he click logout he...logout problem..  hi... first of all thanks for ur
session.timeout and notification before session expire in java
session.timeout and notification before session expire in java  Hi... notification page when the session expires; but I want this to happen without user...; session timeout is 30 min; I would want the page to automatically forward to another
jsp logout code
for logout in jsp and also how to immplement it. thanking you...jsp logout code  hello sir, im doing jsp project, i have implemented the session code of jsp. session.invalidate(). but its not working. can u
Logout?
Logout?  how to logout from a jsp page?   Hi to logout from Jsp Page.you should use session.invalidate() method. *khalidkhan
Simplest Login and Logout example in JSP
Simplest Login and Logout example in JSP   This JSP example shows you how to login and logout the session between JSP pages. JSP provide an implicit object that is session in which use to save
How to use filter to redirect to login page after session timeout.
How to use filter to redirect to login page after session timeout.  ... session timeout . means if screen is inactive for a particular period of time then automatically it should redirect to login page from where user has
Advertisements
 

 

 

DMCA.com