In html I have an image tag like this:
<img wicket:id="image"/>
and in code:
Resource resource = ....
Image image = new Image("image", resource);
I also tried:
Image image = new Image("image", new Model("/images/sunshine.png"));
But than it tries to find the images in the package (as package resource).
How can I simple create an Image object which loads the image relative from the webcontext root, and how do I add a random parameter so that the browser
will allways reload the image.
Thanks,
Evert
2006/5/7, Anatol Pomozov <
[EMAIL PROTECTED]>:
I usually do such thing
/<path_to_img>.png?<random_number>
so example image path is /images/logo.png?32342342342 or /images/logo.png?rand=32342342342On 5/7/06, Bruno Borges <[EMAIL PROTECTED]> wrote:Make random URLs for the image. You can do that simply adding dummy parameters, like /image.ext?foo=bar1, bar2, bar3... etc. The browser cache resources per URL.
I think this will work.
See yaOn 5/7/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:well, if the browser ignores that then you should change the url.
-IgorOn 5/7/06, Potje rode kool < [EMAIL PROTECTED]> wrote:Yes, its a caching problem, when I disable caching in Firefox (doing this with the web developer toolbar) it works fine.
How do I add those headers for the images I want to disable caching for. I tried to set some headers on my WebResource subclass
I use like this:
response.setDateHeader("Expires", System.currentTimeMillis());
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0");
But that doesn't seems to work.
Thanks in advance,
Evert2006/5/7, Igor Vaynberg < [EMAIL PROTECTED]>:are you updating img's src attribute in the ajax call? or is the image streamed from somewhere and reflects a property you changed with ajax?
the first should work
the lettter might not unless the url changes - because the browser would have the cached version and no reason to reload it. so you either have to update the url and add a &rand=randomnumber parameter to force the browser to reload the image or add no-cache no-store headers when you are streaming the image.
-IgorOn 5/6/06, Potje rode kool <[EMAIL PROTECTED]> wrote:Hi,
I am trying to change an image after an AjaxLink is clicked but I can't get it working.
The images are on a Panel, when I click on the AjaxLink I create a new Panel and replace the old one (by calling getPage().replace(Component) ).
I also have put an Label on the Panel and the Label gets updated when I click on the AjaxLink, but not the images.
Do I have to do something extra to let images update or does Wicket doesn't support updating images by Ajax?
Thanks in advance.
Evert
--
Bruno Borges
[EMAIL PROTECTED]
Sun Certified Java Programmer for 1.4
Sun Certified Web Component Developer for 1.4--
anatol ( http://pomozov.info)