Realtime servlets? Newbie Question

B

Brian

'Ello,

I'm interested in creating a page which will display some information
and update itself so many seconds without the need to hit the Refresh
button in the browser.

Which technology do I want to look at to do this? I have been
learning Tomcat5.0 and Java Servlets, and have had success with
displaying the information I want. But now I want to take this to the
next step and to be able to have the page update itself without the
user having to Refresh.

Thanks for any info.
 
S

Sudsy

Brian said:
'Ello,

I'm interested in creating a page which will display some information
and update itself so many seconds without the need to hit the Refresh
button in the browser.

Which technology do I want to look at to do this? <snip>

Just use HTML/HTTP. Include something like this in your document:
<meta http-equiv="refresh" content="XXX">
(where XXX is the number of seconds)
 
S

Silvio Bierman

Sudsy said:
Just use HTML/HTTP. Include something like this in your document:
<meta http-equiv="refresh" content="XXX">
(where XXX is the number of seconds)

Which can also be done by calling


response.setHeader("refresh","XXX");

prior to opening the output stream.

An alternative is to include some JavaScript in the page that will set a
timer to do the refresh.

Silvio Bierman
 
S

Sudsy

Silvio said:
Which can also be done by calling


response.setHeader("refresh","XXX");

prior to opening the output stream.

Sure, if you're running a servlet. You'll note that the OP mentions
"creating a page", not generating one from JSP or a servlet. I was
just citing the LCD.
 
S

Silvio Bierman

Sudsy said:
Sure, if you're running a servlet. You'll note that the OP mentions
"creating a page", not generating one from JSP or a servlet. I was
just citing the LCD.

Based on the topic I concluded he was using servlets. In JSP it is also
possible BTW, but you have to make sure you put the code in front of any
output because otherwise you will get in invalid state exception.

Silvio Bierman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top