Re: Server side time updating jsp

From: Chris Smith (cdsmith_at_twu.net)
Date: 04/28/04


Date: Wed, 28 Apr 2004 07:51:40 -0600

Paul Lee wrote:
> However, I am unsure as to how to do the auto refresh. I would like
> this to happen every second, and I thought about using the <meta-http
> equiv="refresh" ... tag, but this will lead to screen flicker at every
> refresh. I am looking at the <jsp:forward page="this_current_page.jsp"
> /> call but I can't determine if this has a timer/delay parameter
> included. I still think that this will cause some flicker, though.

The jsp:forward action runs on the server as the page is being
generated. It doesn't solve your problem.

Basically, what you've got is a client-side problem; especially give
your desire to avoid refreshing the page. What you need is a client-
side solution (i.e., not JSP) that works with your server-side stuff.
The most obvious answer in JavaScript.

First of all, if your goal in refreshing every second is to keep the
time updated, then you could save a lot of network round-trips and get a
more consistently correct time by decreasing the frequency with which
you update the time from the server, and instead do counting of seconds
on the client in JavaScript. You'd still want to synchronize with the
server occasionally (maybe once every ten seconds) just to avoid time
drift or detect if the server's clock is changed manually.

As for how to do the server interaction, I can see two techniques. You
could use the IE and Netscape-specific XMLHTTPRequest class to ask for
an XML document on the server, which would be generated from a servlet,
and then use that... or you could use that trick where the server never
finishes writing the page and just keeps writing JavaScript <script>
tags that update the earlier content.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation


Relevant Pages

  • Javascript on the client as an alternative to Perl/PHP/Python on the server
    ... I've been writing Javascript for quite a while now and have, of late, ... been writing quite a lot of AJAX and AJAX-related code. ... with Javascript providing limited frontend functionality. ... The critical point is that the page is "pre-built" on the server. ...
    (comp.lang.javascript)
  • Re: problem resetting newsgroup list
    ... refreshing the list of available groups. ... download stalls and the disc access light keeps flashing. ... Any ideas what this is and how to keep it from hanging? ... server has dropped some of its groups so I wanted to refresh the list. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Knowledge management (for Embedded engineers)
    ... > The group's replies were very refreshing. ... I run a Linux server to do this. ... standard formats (HTML, XML, PDF etc), assists in the task of storing the ... > collaboration with customers and for engineers to keep their materials. ...
    (comp.arch.embedded)
  • Re: problem resetting newsgroup list
    ... refreshing the list of available groups. ... 55,000 the download stalls and the disc access light keeps flashing. ... Sometimes it will complete normally and others it will keep hanging ... server has dropped some of its groups so I wanted to refresh the list. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Name generation issues between 2000 Server and 2003 server
    ... the problem correctly, you are writing JavaScript in the page, as ... JavaScript, and linking to names you expect to be there. ... points to non-existent controls. ... 2000 Server generates of the form:- ...
    (microsoft.public.dotnet.framework.aspnet)