Friends, I want to know as to how a servlet can be automatically refreshed after a given amount of time. The data shown in the servlet should be automatically updated as and when the database is updated. Advance Thanks. ------------------
Prabhu, Jason Hunter explains 2 techniques for this kind of auto refresh requirements. 1. Client pull and 2. Server Push. Client pull - means the client (the browser) automatically makes a request for every *** seconds period. Server push - means the server sends the reponse automatically to the browser. I grabbed the code for client pull from Jason Hunter's site for you. This example shows , the client makes a request to every 10 secs to a servlet automatically and diplays the time. See it online here. http://www.servlets.com/servlet/ClientPull Here is the code. For the other tech (Server push) please go through the examples and find out. I try to post when I come across that. Here is the examples link http://www.servlets.com/jsp/examples/index.html regds maha anna
Did anyone try the server push? I tried it on both Websphere and Tomcat, but only the last portion was shown. Is there anything on the server side(servelt engine) that is holding up the flush() which can be changed in the setting? Thanks.
I knew it works on Jason's server. According to him, it is running on Java Web Server 1.1. I just could not run the same example on Tomcat nor on Websphere. Just wonder if anyone has tried it on newer servlet engines.
Joined: Oct 29, 2000
Frank, I haven't tried it yet. Hence I am not sure whether it works on any other servers. In Jason's book, he says that server push is not supported by IE(which version?), and is to be avoided if possible since it is found to be harmful for the server's available socket count. I tried the servlet(On Jason's webserver) on IE 5.5 and Netscape 4.73. It worked perfectly on Netscape. But IE did not recognize the type and the result was not expected. Thanks, HMenon
I tried this with J2EE and it works. One thing that i didn't get though is with ie the response appears one below the another while in netscape the lines seems to refresh showing just the one line at a time.. Any information on this will be appreciated.... [This message has been edited by Ash (edited February 15, 2001).]