schroom
asked on
javascript reset and jsp session.invalidate
THis is a javascripte and JSP question.
I am not sure of the syntax for ending the session on a JSP page, that is form.
That is instead of using a straight reset button, and clearing the form fields, I am trying to end the session using a reset button>
<%
session.invalidate();
<a href="#" onClick="document.pensionB enefits.re set(); return false"><IMG src="images/butn-reset-e.g if" width="73" tabindex="28" height="18" border="0" alt="Reset" align="bottom" ></a>
%>
I am not sure of the syntax for ending the session on a JSP page, that is form.
That is instead of using a straight reset button, and clearing the form fields, I am trying to end the session using a reset button>
<%
session.invalidate();
<a href="#" onClick="document.pensionB
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried your suggestion, and it didn't seem to work. The reset button is clicked and the go to the endMySession.jsp, which has the
<%
session.invalidate();
// I just refreshed the page, but he session is still there.
%>
<a href="endMySession.jsp" ><IMG src="images/butn-reset-e.g if" width="73" tabindex="28" height="18" border="0" alt="Reset" align="bottom" ></a>
Is there a way to clear the session without leaving the page, as they will will what to refill the form after resetting it.
<%
session.invalidate();
// I just refreshed the page, but he session is still there.
%>
<a href="endMySession.jsp" ><IMG src="images/butn-reset-e.g
Is there a way to clear the session without leaving the page, as they will will what to refill the form after resetting it.
Try targetting the endMySession.jsp into a hidden frame or sending it to a popup window that displays a confirmation message.
Steve
Steve
Perhaps you can put some conditional logic at the top of the page--something like:
if request.form("Reset") = "Reset" then
session.invalidate
end if
That way, when the user clicks on the reset button, it returns him/her to the same page with the form with a terminated session.
Fritz the Blank
if request.form("Reset") = "Reset" then
session.invalidate
end if
That way, when the user clicks on the reset button, it returns him/her to the same page with the form with a terminated session.
Fritz the Blank
ASKER
Thanks everyone for your help.
using:
<a href="endMySession.jsp" ...
where I have the below (added the response stuff, it has cleared the session.
I can then use the referrer to get back to my form.
<%
session.invalidate();
response.setHeader("Cache- Control"," no-cache") ; //HTTP 1.1
response.setHeader("Pragma ","no-cach e"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
and going to <a href="endMySession.jsp"
using:
<a href="endMySession.jsp" ...
where I have the below (added the response stuff, it has cleared the session.
I can then use the referrer to get back to my form.
<%
session.invalidate();
response.setHeader("Cache-
response.setHeader("Pragma
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
and going to <a href="endMySession.jsp"
ASKER
I will try what you have posted and get back to you soon.
Thanks