| Author |
Struts action in html:img tag not always executed
|
Nicole Seidl
Greenhorn
Joined: Apr 11, 2006
Posts: 2
|
|
Hi everyone, I'm using the line <IMG SRC="/[project_path]/DisplayImage.do?ImageID=1" /> on multiple jsp pages, to display the image of a chart that I generate using data from a database. Everything is fine the first time around , but after i navigate to another page using that line, something goes wrong. The new page displays the image of the old chart, not the new one, because the DisplayImage action is not called. If i right-click on the image and choose 'view image', the Display action is called and the correct image is displayed. The correct image is also displayed if i hit F5. I assumed that my browser was caching the image, but after turning off caching nothing improved. Is there any way of forcing the DisplayImage action to fire, or maybe refresh the page after it's loaded( although that would be a little annoying)? Many thanks in advance.
|
 |
Brent Sterling
Ranch Hand
Joined: Feb 08, 2006
Posts: 948
|
|
This really sounds like a browser caching issue. What browser are you using and what did you do to turn off caching? In any case, this is an issue you will have to solve because you cannot expect all end users to turn off caching. One strategy would be to append a random value to the end of the URL so that it is always (or at least almost always) unique. So you would generate something like this: /[project_path]/DisplayImage.do?ImageID=1&random=947483 - Brent
|
 |
Nicole Seidl
Greenhorn
Joined: Apr 11, 2006
Posts: 2
|
|
Thanks for the solution, Brent. I added a time=System.currentTimeMillis() parameter to SRC and it all works perfectly now. Cheers, Nico
|
 |
 |
|
|
subject: Struts action in html:img tag not always executed
|
|
|