The way I have done this is I have the following on all my pages:

<body onLoad="hidePleaseWait();">
<%@ include file="/inc/pleaseWait.inc" %>
<span id="lyrMain" style="display:none;">

pleaseWait.inc is the HTML for my Please Wait display.  For me, it's a
little clock with spinning hands and a message artistically offset saying
"Please wait, the system is busy processing your request..." centered on
the page.  The important point is that the first and last lines of that
include file are:

<span id="lyrPleaseWait" style="display:block;">
...
</span>

Just before I submit any form, I call showPleaseWait(), which is a
Javascript function in pleaseWait.inc, and it is basically just:

lyrMain.style.display = "none";
lyrPleaseWait.style.display = "block";

One last piece of the puzzle... that hidePleaseWait() function called
onLoad is:

lyrMain.style.display = "block";
lyrPleaseWait.style.display = "hide";

So, every page that loads starts out showing that Please Wait layer, and
when it's done loading it hides that and shows the main content.  When a
form is submitted, the main content is hidden and the Please Wait layer is
shown.  It works quite well.

I actually do something a bit more complex in one of my apps because it is
frames-based and I actually target all submissions to a hidden frame, but
the overall concept is the same.  So, if you don't have a problem with the
requirement of scripting, this works well.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, May 24, 2005 9:26 am, Marc Demlenne said:
> Hi all,
>
> Using Struts, I'm looking for a good practice to have a "Please wait
> box" displayed to the user when the action he has requested takes a
> long time.
>
> My requirements are not to display another page to keep the browsing
> "smooth". I use a JSP tree which can be expanded/collapsed, but the
> page must stay the same between the calls. So I'd like a small box
> added in front of the actual window.
>
> What I could do is to use a javascript to show or hide a small box in
> a corner of the window for instance. The problem is that i want this
> box to be displayed immediately when the ActionClass is called, and
> hided only when the result page is fully displayed. This is very easy
> when it is the displaying of the page which is slow (when the logic is
> inside JSP), but doesn't seem so easy with struts, where it's the
> action that can take time.
>
> Can anyone help me with this ?
>
> --
> Marc Demlenne
> GPG : 768FA483 (http://pgp.mit.edu)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to