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
488 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 500 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa‚Ķ
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
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).

726 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