struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas De Loof" <nicolas.del...@cgey.com>
Subject Re: Tag to remove jsp from cache???
Date Tue, 01 Jul 2003 12:41:41 GMT
You can configure Struts to ad HTTP no-cache headers to every response :

in struts-config.xml :
    <controller nocache="true"/>

You can add some HTTP directives to your JSP (or tiles layouts) like this :

<head>
    <meta http-equiv="expires" content="now">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
</head>

Nico.



> Before you send any data in the response you can 
> Send the following thru your response object:
> 
> <% 
>    response.setDateHeader ("Expires", 0);
>    response.setHeader ("Pragma", "no-cache");
>    if (request.getProtocol().equals ("HTTP/1.1")) {
>       response.setHeader ("Cache-Control", "no-cache");
>    }
> %>
> 
> Note, however that users can still go back in history
> And resubmit their data. Browsers maintain history list
> And unfortunately they do remember form data too. So if
> Your user submitted a request and then clicks back button,
> The browser will ask him/her if he/she wants to resubmit 
> the data? I saw a note somewhere in Ted's (I think) book 
> about how you can prevent this kind of submission on the 
> server side but have not explored that further. Now I 
> can't even remember where I saw it. 
> 
> The gist of it is that before you send the form to be 
> submitted by the user you stamp it, and remember what is 
> it you still expecting from the user inside the Session 
> context. If user submits the form with the right stamp 
> the request is processed, otherwise you can tell the user
> to stop resubmitting the same request.
> 
> Alex.
> 
> > -----Original Message-----
> > From: Prashanth.S [mailto:suman291857@yahoo.com]
> > Sent: Tuesday, July 01, 2003 8:08 AM
> > To: struts-user@jakarta.apache.org
> > Subject: Tag to remove jsp from cache???
> > 
> > Hi all,
> > Is there any tag in struts to remove cache??
> > Whenever i hit  Browser 'Back' button it should not take from the
> cache..
> > Any help is appreciated..
> > or is there any option to do that
> > Thanks
> > Prashanth
> > 
> > 
> > ---------------------------------
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message