wood burning stoves 2.0*
The moose likes Servlets and the fly likes make servlet continually refresh page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "make servlet continually refresh page" Watch "make servlet continually refresh page" New topic

make servlet continually refresh page

igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
hello, i've written a servlet that sends a certain number of messages. but, in the servlet response, i want it to be able to write a message to the screen each time a message is sent. So my question is, how do I automatically reload a page with a new value for a servlet. Thanks.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Put a meta refresh tag on the page

Example: For a 15 second refresh..

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213

will also work

Sarath Mohan
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
Alternate approach if only a small amount of data on the page needs to be updated would be to use JavaScript to make the request to your servlet and update the contents. This involves a LOT more work.
igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
Thanks for the help. it works
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
For true push from server to browser you can implement an applet that opens a ServerSocket and registers the IP & port with the app server. We use this to push messages to selected subsets of users, eg everyone in some site or some product support group. It's fairly tricky, but lets the server control who gets what with no polling from the browser.
[ March 29, 2005: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link: http://aspose.com/file-tools
subject: make servlet continually refresh page
Similar Threads
How to give alert message in servlet and redirected it to jsp page.
Re: Servlet Redirect with time delay
How can i use message window in servlet
calling javascript function
Problem with displaying image using jsp