File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Refresh Client from server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Refresh Client from server" Watch "Refresh Client from server" New topic

Refresh Client from server

Serghei Jelauc
Ranch Hand

Joined: Jul 24, 2002
Posts: 128
Hi all.
I have the next question about JSP.
How can I refresh clients pages from server? For example if there is JSP chat. Every time when new user enter in chat, its name must appear in list of users. But if you enter before this user, you page must be refreshed (with out you push sent button or something else) from server.
How I can do it?
thanks in advance.

SCJP 1.4 <br />SCBCD 1.3<br />SCWCD 1.4
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
If you are using just regular servlets or JSP producing HTML pages, you can't do this. The nearest you can come is to get the page in the client browser to refresh itself every few minutes to check if anything has happened.
If you really need more than this, you probably need an applet, or even a proper application, running on the client machine. Web pages, even with JavaScript or DHTML, are essentially dumb, static things. They cannot listen for external messages from remote machines.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: Refresh Client from server
It's not a secret anymore!