This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes Client Call Backs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Client Call Backs" Watch "Client Call Backs" New topic

Client Call Backs

Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
Hi. I'm using the struts framework to implement a registration system for a University. Is there any way to force a browser refresh when, for example, the number of slots remaining in a class changes?
Any help would be greatly appreciated. Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17151

No. HTTP can't "push", only respond to "pull" requests. About as close as you can get would be to setup a page that has a periodic refresh.
Somebody trying to use a page to sign up for courses would find that rather intrusive, however; their data input would be disrupted. If you're thinking about a public display (something like airport flight monitors), then a periodic refresh should be OK.

An IDE is no substitute for an Intelligent Developer.
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
Ok, thanks.
Jim Wang
Ranch Hand

Joined: Oct 04, 2001
Posts: 41
There has a javascript function let your load page from url ( location.replace(url) ). I think if you put a timer before it, you may get refresh function. But it's not good to force your client to do something.
I agree. Here's the link:
subject: Client Call Backs
jQuery in Action, 3rd edition