I am working with JSP and Servlets where I need to show the error page and I have to kill the session when user clicks on back button of the browser.I do not want to disable the back button of browser. I am opening pages in IFrame of other application meanwhile I lost my application session. If anybody find this type of issue please give me the solution. Thanks.
Asked
Active
Viewed 1,262 times
0
-
You cannot disable the browsers back button. You can't use the back button if browsers history object reaches the first element (because it is an array). – Reporter Sep 17 '14 at 12:15
-
You can use jquery plugin https://github.com/asual/jquery-address. – Manwal Sep 17 '14 at 12:18
1 Answers
0
Error notice page is the end of browsing flow. Create file error_notice.jsp (have snippet isErrorPage="true"
) like that:
<%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true" %>
<html>
<head>
<title></title>
</head>
<body>
<h2 style="color: red; text-align: center">There are something error! Please come back!</h2>
<%
request.getSession().removeAttribute("anAttribute");
%>
</body>
</html>
If you want remove all session attributes, do this in Java code. See more: https://stackoverflow.com/a/22120172/3728901