Update picture in browser

Simon nmin at FREENET.DE
Wed Nov 7 03:25:14 PST 2007


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