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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "automatic refreshing" Watch "automatic refreshing" New topic
Author

automatic refreshing

James Hewitt
Greenhorn

Joined: Jul 09, 2001
Posts: 27
I have a java servlet that displays the output of a database (after some manipulation) as an html page. Part of the output is a time. This time is compared to the current time when the page is refreshed, and a calculation is performed to see if the stored time is before or after the current time.
How can I make the servlet automatically redraw the html page every 5 minutes (for example), so I do not have to press the refresh button on the browser?
Many Thanks,
James
Cherry Mathew
Ranch Hand

Joined: Dec 26, 2000
Posts: 159
Hi,
Its not a good practice to let the sevlet do that.
u can write a javascript which request the servlet to refresh the page every 5 minutes. Most sports sites do this.
Cherry
James Hewitt
Greenhorn

Joined: Jul 09, 2001
Posts: 27
The problem is that the servlet is generating the entire html web page, using out.println. Will there be problems if I embed javascript into this? If not, how do I do this?
Thanks,
James
James Hewitt
Greenhorn

Joined: Jul 09, 2001
Posts: 27
actually ignore this post. I've sorted it with meta tags.
Thanks,
James
Anoop Krishnan
Ranch Hand

Joined: May 03, 2001
Posts: 163
Hai James,
This is not a answer.Do you think that creatting an HTML page from a servlet by simply using the out.println() is good.What happens if you just want to change a single text in your final out put html page ?
You have to change your servlet & redeploy it
Think about it ...........


I just want to know is there any body call my bean's Getter and Setter methods with "Please" in front - My favorite quip from Bugzilla
Rehan Malik
Ranch Hand

Joined: Jul 09, 2001
Posts: 76
It seems that most of your work is presentation based. I would recommend making a JSP page out of this. At my old company, a portion of their web application had to refresh a page every 30 seconds (which is a similar effect you are looking for). You could easily create a javabean to handle the database connections and the query to the database and return the data as a vector.

Originally posted by James Hewitt:
I have a java servlet that displays the output of a database (after some manipulation) as an html page. Part of the output is a time. This time is compared to the current time when the page is refreshed, and a calculation is performed to see if the stored time is before or after the current time.
How can I make the servlet automatically redraw the html page every 5 minutes (for example), so I do not have to press the refresh button on the browser?
Many Thanks,
James


Rehan Malik
 
Don't get me started about those stupid light bulbs.
 
subject: automatic refreshing
 
Similar Threads
Output from a server to a html page
redirect in a filter class
Reading .asp file from servlet
servlet ......a simple problem
Refresh Header