Image refresh problem.

644 views
Skip to first unread message

YUN TAO

unread,
Mar 10, 2008, 11:08:00 AM3/10/08
to Google Web Toolkit
I used a PushButton as a place holder for captcha images. I wrote a
servlet to generate the captchas. When the application is first loaded
the captcha is retrieved successfully, but now I want to add a new
functionality that if I click on the button the captcha image we will
get a new captcha image in the PushButton.

The problem is that the servlet always has the same URL, seems GWT
will not fetch the image again if the url is already fetch the first
time.

Ian Petersen

unread,
Mar 10, 2008, 11:25:13 AM3/10/08
to Google-We...@googlegroups.com
On Mon, Mar 10, 2008 at 11:08 AM, YUN TAO <hytpar...@gmail.com> wrote:
> The problem is that the servlet always has the same URL, seems GWT
> will not fetch the image again if the url is already fetch the first
> time.

That's a feature of the browser, not GWT. You need to make the URL
variable. You could probably just add something to the end of it like
'?variable=1' and increment the 1 every time you need a new image.
The servlet will ignore the extra parameter (unless you programme it
to pay attention to the extra parameter, of course), but the browser
doesn't know that, so it will re-request the image. You might want to
use the current time in milliseconds, or something, rather than
starting at one every time in case the browser caches your image.

Ian

--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com

YUN TAO

unread,
Mar 11, 2008, 3:42:46 AM3/11/08
to Google Web Toolkit
Thanks! It works now like a breeze.
Reply all
Reply to author
Forward
0 new messages