This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Back button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Back button" Watch "Back button" New topic
Author

Back button

Viet Jav
Ranch Hand

Joined: Dec 27, 2001
Posts: 55
Hi,
How to when a user click on the back button of the browser an expire message will appears?.
I have 2 JSP A and B
In A page: user use thid page to register his data. After finishing input data, he click Submit button--->his data will insert into DB by Servlet and then forward(B page)display B(notice insert sucessfully!).
On B page, when user click Back button if browser---> A page display.

I want when user click Back button on B page ----> Expire message page display.
How solve my problem?

The following are my code, but not work:
On top of my A and B page:

<%@ page language="java" contentType="text/html; charset=ISO-2022-JP" %>

<% response.setHeader("Pragma","no-cache");%>
<% response.setHeader("Cache-Control","no-store");%>
<% response.setDateHeader("Expires",-1);%>
....

Your help is appriciated.
JV.
Sagar J Jambhulkar
Greenhorn

Joined: Sep 10, 2004
Posts: 8
try this

<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>

also this should be at the top of page.meaning before any output is commited cos these are HTTP headers we are setting


Love Work and Bless All and you will be blessed by God<br />-----Sadguru Wamanrao Pai
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Back button