Adam

Thanks - I'll check this out - but a question - you may be able to answer.

In my application, the forwarded-to jsp is the result of a call to
retrieveDataAction.

The image embedded in the page is as a result of a call to createimageAction -
which returns null - will setting the nocache property in the controller handle
this situation correctly?

David

-----Original Message-----
From: Adam Hardy [mailto:[EMAIL PROTECTED]
Sent: 19 June 2003 15:16
To: Struts Users Mailing List
Subject: Re: Image cache problem - solved


Struts 1.1 will do this for you automatically if you set the following
in your struts-config.xml

<controller>
     <!-- all pages get HTTP headers to defeat browser caching -->
     <set-property property="nocache" value="true"/>
   </controller>

David Bolsover wrote:
> Remke
>
> Thanks
>
> I was already setting:
> response.setHeader("Cache-Control","no-cache");
> response.setHeader("Pragma","no-cache");
> In the jsp containing the image to solve the problem of page caches.
>
> What caught me out was that this had to do this for the image also - as I had
> just done before your mail came in!
>
> In my createimageAction I now have:
>
> OutputStream sos = response.getOutputStream();
> response.setHeader("Cache-Control","no-cache");
> response.setHeader("Pragma","no-cache");
> response.setContentType("image/jpeg");
> .... write image to sos
> sos.close();
> ....
> return null;
>
> Problem solved :-)
>
> David
>
>
>
> -----Original Message-----
> From: Remke Rutgers [mailto:[EMAIL PROTECTED]
> Sent: 19 June 2003 13:24
> To: 'Struts Users Mailing List'
> Subject: RE: Image cache problem
>
>
> Hi David,
>
> I think it has nothing to do with browser versions, I think this is only
> caused by caching settings. You must realize that caching can occur both in
> browser cache (configure this using Tools->Internet
> Options->General->Temporary Internet Files->Settings) and in proxy server
> cache. You should force your createimage.do to be non cachable. (Instruct
> proxy servers and browsers to always retrieve a fresh version)
> You can achieve this by setting a HTTP header:
> response.setHeader("Cache-Control","no-cache");
> see the javadocs for more on the setHeader method of the response object.
>
> See http://www.mnot.net/cache_docs/ for a very good tutorial on caching.
>
> Remke
>
>
> -----Oorspronkelijk bericht-----
> Van: David Bolsover [mailto:[EMAIL PROTECTED]
> Verzonden: donderdag 19 juni 2003 13:51
> Aan: Struts User
> Onderwerp: Image cache problem
>
>
> Hi all
>
> I have been using struts for some time now but a new problem has come up:
>
> I use a form to select some options needed retrieve some data required to
> generate a graph.
>
> For the sake of clarity, I'll call this retrieveDataAction.
>
> retrieveDataAction gets the data and places it into session scope under key
> 'GRAPHDATA' the user is then forwarded to displaydata.jsp.
>
> displaydata.jsp contains the following (simplfied):
>
> <logic:present name="GRAPHDATA" scope="session" >
>
> <p><html:img page="/createimage.do" /></p>
>
> </logic:present>
>
> The createimageAction retrieves the GRAPHDATA from session scope, generates
> a
> gif image and writes it to response.OutputStream(), closes the stream and
> returns null.
>
> The problem I have is that at least one client (using IE 5) finds that the
> same
> image is always presented even though he has requested some different data.
> I
> have not been able to reproduce the problem using an IE 6 client - does
> anyone
> know if this is an IE 5 'feature' and - is there a solution?
>
> David Bolsover
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to