Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes no-cache not expiring web page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "no-cache not expiring web page" Watch "no-cache not expiring web page" New topic

no-cache not expiring web page

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
In the below servlet A i am able to get the no cache to work so when i hit the back button the page is expired.

I am using this same exact code in another servlet. The only differenc i can think of is the i am using the PRG patten with it. So i do a process then it redirects to servlet B and displays the invoice page. However if i hit back from here the page is not expired and will still display.

any ideas?

thanks john



[ December 06, 2008: Message edited by: John Schretz ]

[ December 06, 2008: Message edited by: John Schretz ]
[ December 06, 2008: Message edited by: John Schretz ]
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
As you are aware, the whole point of the PRG pattern is to prevent double submit when you refresh the result page after a post request. Hence using a redirect instructs the browser to initiate a brand new request. So you are not getting a "page expired" error message anymore when you go back to the previous page which is not been cached by the browser.

I think this is what is happening. However, the more knowledgeableand very helpful folks here will probably have a better explanation.
[ December 06, 2008: Message edited by: Bosun Bello ]

So much trouble in the world -- Bob Marley
subject: no-cache not expiring web page
Similar Threads
How to Close Connections made In Servlet
Checking for Session Timeout
forEach not working
RequestDispatcher.forward problem
session mix up