Link to home
Start Free TrialLog in
Avatar of lewin85_sg
lewin85_sg

asked on

Refreshing JSP codes to check for data updates without refreshing the entire browser(eg. does not affect a user reading a article while constantly refreshing in the backgrd)

Hi.. I have a urgent question. Basically I have this site written in JSP that allows one computer to send a "instant message" to another computer(both at a specific webpage of my site). The message sent is first stored in a vector/file/db and then retrieved when computer B(reciever) refreshes the page and the codes check that boolean newMsg=true; and displays the message in a Alert box.

My problem is, the reciever has to manually click refresh to check for any new messages. What I need is for the "refresh" to somehow.. run (in the background?) without disturbing the reciever(perhaps reading a article). And when a new message is detected, the Alert box will pop up.

Hope I make this clear enough. Please help! Thanks!
ASKER CERTIFIED SOLUTION
Avatar of linc0ln
linc0ln

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jimmack
jimmack

linc0ln is correct, you can't "push" from a server to a browser.  The browser is in control of the communications and the server simply responds.

<META HTTP-EQUIV=Refresh CONTENT="10; URL=http://url.to.servlet">

The meta-refresh should be nice and easy to implement (not all browsers support it, but I don't know which ones).  You could do it with an applet, but that's considerably more work ;-)
I dont'think there are any graphical browsers that produced in the last 6-7 years that don't support meta refresh tags. That shouldn't be an issue.
;-)  Thanx Zontar.
Avatar of lewin85_sg

ASKER

Thanks guys :)