Dynamically Refresh JSP's

Discussion in 'Java' started by Wells, Jun 14, 2004.

  1. Wells

    Wells Guest

    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...
    Wells, Jun 14, 2004
    #1
    1. Advertising

  2. Wells

    Guest

    Wells wrote:

    > 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.
    , Jun 14, 2004
    #2
    1. Advertising

  3. Wells

    javaseeker Guest

    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..







    "Wells" <wshammou-(noSpam)@optonline.net> wrote in message news:<CY6zc.7906$>...
    > 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...
    javaseeker, Jun 14, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. brian lanning
    Replies:
    0
    Views:
    591
    brian lanning
    Jul 29, 2003
  2. Per Magnus L?vold
    Replies:
    1
    Views:
    5,115
    John C. Bollinger
    Oct 8, 2004
  3. Replies:
    0
    Views:
    4,353
  4. albert kao
    Replies:
    1
    Views:
    697
    Arne Vajhøj
    Feb 2, 2010
  5. albert kao
    Replies:
    1
    Views:
    154
    Arne Vajhøj
    Feb 2, 2010
Loading...

Share This Page