Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


Refresh image via JavaScript

  • Oswaldo Dantas
    Oswaldo Dantas


    I'm developing a portlet that should show an image that should be refreshed every X seconds (only the image, not the browser because of other portlets).
    If I try to open the same image URL with Cewolf I get the same image, even if the data changed because the logic on the servlet doesn't get to the data producer.
    I'd like to know if there is any way I can change this behavior (some option, configuration, parameter somewhere...), so I can always get an image with the updated values, or I will have to create new code to get that functionality.

    For the refresh, I intend using an adaptation of the code found in


    • Guido Laures
      Guido Laures

      The problem is that the img url points to a prerendered image on the server. Thus, same img id returns the same image.
      What you could do is to write a JSP that just returns the <img> tag and use AJAX technologies to incorporate this tag into your page dynamically. Cewolf needs a full JSP server roundtrip to render a new image.