Update picture in browser
Marcos Sánchez Provencio
marcos at BURKE.ATH.CX
Wed Nov 7 07:02:25 PST 2007
I would try setting response headers (not tested):
<%
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "Mon, 01 Jan 2001 00:00:01 GMT");
response.setHeader("Cache-Control", "no-store");
response.setHeader("Cache-Control", "must-revalidate");
response.setHeader("Cache-Control", "no-cache");
%>
El mié, 07-11-2007 a las 05:25 -0600, Simon escribió:
> Hi,
>
> im sorry for this stupid question, but I'm running out of ideas.
>
> I created a jsp Page using mapscript to generate a gif picture out of my GIS
> Data, and it works just fine.
>
> The jsp page receives the GIS Data via a webservice ... so the Data changes
> and the picture is newly-created each time the GIS Data has changed.
>
> The problem is, that my browser ignores the changes sometimes. So, the page
> is loaded again and the shown picture is still the old one, even though it
> doesn't exist anymore.
>
> The picture is shown in an <input> tag, here is the code:
>
> page.jsp
> ========
>
> <meta http-equiv="expires" content="0">
> <meta http-equiv="pragma" content="no-cache">
> <meta http-equiv="cache-control" content="no-cache">
>
> ...
>
> <%
> mapObj map = new mapObj(mapfile); //mapfile is resolved out of a POST request
> imageObj image = map.draw();
> image.save(this.tmpPath+"/picture.gif",map);
>
> %>
>
> out.println("<div id=\"map\" >");
> out.println("<input type=\"image\" name=\"karte\"
> src=\""+picturePath+"?id="+Math.round(Math.random()*100000)+"\" >" );
> out.println("</div>");
>
> where picturePath is the URL to the created picture.
> The part with the random number is a solution for this problem from a php
> forum, but it doesn't work so far.
>
> My first idea was, that there is a problem with my IE cache. So I added meta
> tags to my jsp page ... but the problem seems to be somewhere else.
>
> A possible solution would be to give the picture an ID which changes every
> time the picture is created ... but this would be a bit sloppy I think.
>
> Well, maybe somebody of you had simliar experiences ... hopefully.
>
> thanks in advance.
>
> Simon
More information about the MapServer-users
mailing list