How to refresh a servlet from the browser (IE 4)

Hello All,

I have a servlet , which brings some table data, and I would like to refresh the call to the servlet on a time delay... How to do it?

My thinking is , to use an applet , which will run hidden and keep making the http request on a thread delay, IS IT possible?

or IS there a simple HTML/JavaScript function to accomplish this task?

[373 byte] By [kumaranm] at [2007-9-26 9:45:29]
# 1

look at the code below:

public void doGet(HttpRequest request, HttpResponse response) {

response.setHeader("Refresh", "5");

PrintWrite writer = response.getWriter();

writer.println("<img src='shot.jpg' alt='a shto from my web cam'>;");

writer.flush();

response.flushBuffer();

}

v.pavlov at 2007-7-1 21:22:04 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 2

Hello,

Question: Yes, this works, however, my entire page is refreshed and I see that flickering for every 5 seconds...

Is it possible to refresh the servlet only when certain data changes (basically I have status/reminders displayed next to the image and this could change on the server, I would like to poll the server somehow and check this values and if they are changed , then only refresh the servlet)..

Any suggestion(s) appreciated. Tx

Kumaran

kumaranm at 2007-7-1 21:22:04 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 3
Make a hidden frame, and make it refresh each 5 or less seconds.Then use javascript from other frames to parse data from the hidden one and update fields which need to be updated.
v.pavlov at 2007-7-1 21:22:04 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 4
Hello Kumaran, I am facing exactly the same problem as you. If you managed to solve the problem, I would appreciate any code that you can send me. I am new to servlet programming and any help would be appreciated. My email is sh1974@rediff.comThanks
shobhana at 2007-7-1 21:22:04 > top of Java-index,Java Mobility Forums,Consumer and Commerce...