• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

session cahe

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to prevent the user from loading a page that has been cached when the browser is refreshed.
This is the code in my page:
<% response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.addDateHeader("Expires", 0); %>
But when the user hits refresh it still loads the form that was there. The biggest problem is that the browser actually tells you to do this.
browser info:
Warning, Page has expired
..........
To resubmit your information and view this Web page, click the Refresh button.

Any help would be appreciated.
Sam Anjos
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sam,
I also faced this problem & I used sessions to resolve this.If you want to prevent page to refresh,its better you create a session or use setAttribute() from previous page..& in original page check the session or getattribute() for the first time & display the contents & make it null at the end.Now if you refresh do whatever action you want coz session is null now
the pseudocode should look like this
if(request.getAttribute("someObj")!= null)
{
//show whatever u want for first time
request.setAttribute("someObj")=null
}
else
{
response.redirect("tosomepage")
//or do whatever action u want here to prevent refresh
}
Try this it will work

njoi
 
reply
    Bookmark Topic Watch Topic
  • New Topic