Dynamically Refresh JSP's

W

Wells

Hello all,
I wonder if there is a way to do this, any help would be appreciated.

I have a JSP/Servlets web application deployed in Oracle9iAS. We have need
to send a broadcast message to all users of the application (potentially,
100 users or individual sessions). What I need to do is to be able to
dynamically refresh each JSP a user is currently on if the administrative
user decides to send a broadcast message.

Each JSP is currently programmed with a hidden box which is checked for a
value (the message string) when the JSP loads. If the box is not null then
the Message will be displayed at the top. The problem of course is how to
force the JSP to refresh directly from the server?

Is that possible?
I appreciate any help.
Wells...
 
M

mromarkhan

Wells said:
Hello all,
I wonder if there is a way to do this, any help would be appreciated.

The problem of course is how to
force the JSP to refresh directly from the server?

Is that possible?
I appreciate any help.
Wells...


Peace be unto you.

My sources may be dated.
And this is very much
heresay on my part.
But you said "any" help.

There is something called server push
and client pull.

Using Netscape Server Push Technology with ASP
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q250983

Apparently, Internet Explorer (5 <=) does not support
the encapsulation of multiple entities in a response.
http://www.ietf.org/rfc/rfc2068.txt
which is crucial to server push.
http://c2.com/cgi/wiki?MicrosoftInternetExplorer

Microsoft Internet Explorer does support many client pull
technologies.


About Active Channel Features
http://msdn.microsoft.com/library/d...op/delivery/channel/tutorials/development.asp

HOW TO: Enable Client Pull for Web Servers, Sites, and Folders
http://support.microsoft.com/default.aspx?scid=kb;EN-US;240774
"
- Periodically force an Internet browser to reload a page
automatically. Typically, this occurs on a page-by-page basis for a
Web site using HTML.
- Prevent browsers from viewing data that may be out of date,
especially on sites where information is updated frequently. Client
pull is implemented through the HTTP header REFRESH and can be used to
redirect to another page.
"

Using META DATA to refresh pages
http://support.microsoft.com/default.aspx?scid=kb;EN-US;196471

You can also use Javascript
to make a query every now and again,
using setTimeout function.
like
window.setTimeout("getBlog()", 1000);
Where the function javascript getBlog is called
after 1 second or something like that.
Using dhtml makes the whole process seem
seemless.

setTimeout Method
http://msdn.microsoft.com/library/d...author/dhtml/reference/methods/setTimeout.asp


An example of a javascript that pulls
James Gosling's blog

<html>
<head>
<title>James Gosling speaks</title>
<style>
.blog
{
float:left;
width:40%;
padding:1em;
margin:8px;
background-color:whitesmoke;
}
</style>
<script>
function getBlog(site)
{
var XMLHTTP = new ActiveXObject( 'Msxml2.XMLHTTP' );
XMLHTTP.Open("GET", site, false);
XMLHTTP.Send(null);
//window.alert(XMLHTTP.responseText);
var xmlDoc;
var root;
var returnString="<div class=\"blog\">";
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(XMLHTTP.responseText);
root = xmlDoc.documentElement;
var titleNodelist = xmlDoc.getElementsByTagName("title");
var linkNodelist = xmlDoc.getElementsByTagName("link");
var descNodelist = xmlDoc.getElementsByTagName("description");

returnString+="<b>"+titleNodelist.item(0).firstChild.nodeValue+"</b><br>";
for( i = 1; i < titleNodelist.length; i++)
{
returnString+="<a href=\""
+linkNodelist.item(i).firstChild.nodeValue
+"\">"+titleNodelist.item(i).firstChild.nodeValue
+"</a><br>";
}
returnString+="</div>";
return returnString;
}
</script>
</head>
<body>
<script>
document.write(getBlog("http://today.java.net/jag/blog.rss"));
</script>
</body>
</html>


Have a good night.
 
J

javaseeker

Hi there,
Dont know if this would be of much help but try out to force refresh the screen
window.opener.location.href="*.jsp".

Use scriptlets to make it server side.

Enjoy..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top