?
Solved

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)

Posted on 2003-11-13
5
Medium Priority
?
490 Views
Last Modified: 2010-04-06
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!
0
Comment
Question by:lewin85_sg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
linc0ln earned 1500 total points
ID: 9741057
I'm not sure if you can handle that completely on the server side.  I believe what you want to do is create a hidden frame or possibly an iframe, I'll call it the lookup frame.  

In the lookup frame you would run a separate jsp that does the db lookup and if new messages are found, communicates the results to the viewing frame via javascript.  The lookup frame could use a meta-refresh to periodically reload to check for new messages.

Hope this helps.

Linc
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9743432
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 ;-)
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9745907
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.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9746535
;-)  Thanx Zontar.
0
 
LVL 1

Author Comment

by:lewin85_sg
ID: 9747070
Thanks guys :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question