You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marc Demlenne <ma...@gmail.com> on 2005/05/24 15:26:49 UTC

Waiting window with Struts

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts, xhtml & bad tag syntax ... maybe nice in 1.7

Posted by Aladin Alaily <st...@aladin.ca>.
Thanks Niall.

I got your message after I had already sent another to the list.

Aladin



> See the <html:xhtml/> and <html:html xhtml="true"/> tags to do this
>
> http://struts.apache.org/userGuide/struts-html.html#xhtml
> http://struts.apache.org/userGuide/struts-html.html#html
>
> Niall
>
> ----- Original Message -----
> From: "Aladin Alaily" <st...@aladin.ca>
> Sent: Tuesday, May 24, 2005 4:12 PM
>
>
>> Hello,
>>
>> Has anyone tried to make the struts tags xhtml compliant?  Here is what
>> I
>> mean.
>>
>> I have noticed that whenever an html component is generated using the
>> html
>> tags (or any other tag from the libraries), they are usually not closed.
>>
>> For example, when generating a form input field using:
>> <html:text property="whatever">
>>
>> the html code generated looks like:
>> <input type="text" name="whatever" value="">
>>
>> when it should really look like this:
>> <input type="text" name="whatever" value="" /> (Notice the / to close
>> the
>> tag)
>>
>> This is a problem when you want to enforce a specific DOCTYPE to your
>> web-application. The problem can easily be fixed... are struts
>> developers
>> thinking about this problem?  It would be nice to have this addition to
>> Struts 1.7
>>
>> Aladin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts, xhtml & bad tag syntax ... maybe nice in 1.7

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
See the <html:xhtml/> and <html:html xhtml="true"/> tags to do this

http://struts.apache.org/userGuide/struts-html.html#xhtml
http://struts.apache.org/userGuide/struts-html.html#html

Niall

----- Original Message ----- 
From: "Aladin Alaily" <st...@aladin.ca>
Sent: Tuesday, May 24, 2005 4:12 PM


> Hello,
>
> Has anyone tried to make the struts tags xhtml compliant?  Here is what I
> mean.
>
> I have noticed that whenever an html component is generated using the html
> tags (or any other tag from the libraries), they are usually not closed.
>
> For example, when generating a form input field using:
> <html:text property="whatever">
>
> the html code generated looks like:
> <input type="text" name="whatever" value="">
>
> when it should really look like this:
> <input type="text" name="whatever" value="" /> (Notice the / to close the
> tag)
>
> This is a problem when you want to enforce a specific DOCTYPE to your
> web-application. The problem can easily be fixed... are struts developers
> thinking about this problem?  It would be nice to have this addition to
> Struts 1.7
>
> Aladin



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Struts, xhtml & bad tag syntax ... maybe nice in 1.7

Posted by Aladin Alaily <st...@aladin.ca>.
Hello,

Has anyone tried to make the struts tags xhtml compliant?  Here is what I
mean.

I have noticed that whenever an html component is generated using the html
tags (or any other tag from the libraries), they are usually not closed.

For example, when generating a form input field using:
<html:text property="whatever">

the html code generated looks like:
<input type="text" name="whatever" value="">

when it should really look like this:
<input type="text" name="whatever" value="" /> (Notice the / to close the
tag)

This is a problem when you want to enforce a specific DOCTYPE to your
web-application. The problem can easily be fixed... are struts developers
thinking about this problem?  It would be nice to have this addition to
Struts 1.7

Aladin




> 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: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using ActioForm in ActionForm practice

Posted by Michael Jouravlev <jm...@gmail.com>.
Depends. This topic is discussed heavily from time to time. The last
tide was about a month ago :) Search archives.

Basically, if you need only to output your A, B, C entities, you do
not need action forms. Just stick your object in the proper scope.

If you need to input data into A, B, C or your A, B, C are interactive
(that is you need to output them, to modify them, to validate and to
redisplay them on error, and finally to store them back to hibernate)
then I know two obvious choices.

You must recall, that:
* Struts automatically stores request values into action form when
request hits the server.
* Also, action form is a bean, accessible from JSP. Thus, action form
can be used as a buffer for interactive I/O.
* Struts uses setters and getters to access properties.
* Struts does not try to set property, if request does not have
corresponding value.
* Simple redirect does not keep request values.
* Another thing to know, is that action form can handle aggregated
(aka nested) objects.
 
The choices I know of:

(1) Use action form as I/O buffer, business objects would contain only
valid and persisted data. Copy data from action form to BO when you
store data.
(2) Use a separate instance(s) of business object(s) or DTO(s) as I/O
buffer, and store all interactive data there, even invalid data. Valid
data can be persisted to database or wherever.

For (1) you would need to write a lot of setters/getters, but on the
plus side is that you do not need to call your business layer unless
all values are valid. You can check validity in validate() method. On
the other hand, if you already have validation functionality on
business layer, this does not look good.

For (2) You can aggregate your BOs in the action form. In this case
action form should have session scope. Struts would populate your BOs
as nested properties of action form. Less bloat in action form, but
your BOs need to accept strings, to validate input, and to store
whatever was set, even invalid data.

Are you going to handle Refresh button and double submits? After I
typed that huge email, I think I am entitled to a small plug :) Take a
look at DialogAction at
http://struts.sourceforge.net/strutsdialogs/dialogaction.html , maybe
you could use some its ideas.

Michael.

On 6/14/05, Ovidiu EFTIMIE <eo...@gmail.com> wrote:
> Hi,
> I've recently started working on a project that uses Struts 1.2 and
> Hibernate - and I'm in the dev team. Nothing unusual here.
> The project architecture is made in such way that ActionForms are an
> almost 1-1 mirror with the the Hibernate mapped entities.
> For example : if I have an entity A that contains an entity B and a
> list of etities C, in the corresponding forms I'll have Aform
> containing Bform and a List of CForm objects.
> 
> What I would like to know if anyone used the ActionForms in such a way
> , or if this is considered to be a best practice.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using ActioForm in ActionForm practice

Posted by Hubert Rabago <hr...@gmail.com>.
<shameless_plug>:  I hated the 1-1 mirroring of action forms and
business objects, so I wrote FormDef:  https://formdef.dev.java.net/ .
 You may want to take a look at it, it'll save you time keeping the
two in sync, and can also handle deep copying between the two,
especially the current dev version  (
https://formdef.dev.java.net/servlets/ReadMsg?list=users&msgNo=112
).</shameless_plug>

Hubert


On 6/14/05, Ovidiu EFTIMIE <eo...@gmail.com> wrote:
> Hi,
> I've recently started working on a project that uses Struts 1.2 and
> Hibernate - and I'm in the dev team. Nothing unusual here.
> The project architecture is made in such way that ActionForms are an
> almost 1-1 mirror with the the Hibernate mapped entities.
> For example : if I have an entity A that contains an entity B and a
> list of etities C, in the corresponding forms I'll have Aform
> containing Bform and a List of CForm objects.
> 
> What I would like to know if anyone used the ActionForms in such a way
> , or if this is considered to be a best practice.
> 
> Thanx,
> Ovidiu
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using ActioForm in ActionForm practice

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Ovidiu EFTIMIE" <eo...@gmail.com>
> The project architecture is made in such way that ActionForms are an
> almost 1-1 mirror with the the Hibernate mapped entities.
> For example : if I have an entity A that contains an entity B and a
> list of entities C, in the corresponding forms I'll have Aform
> containing Bform and a List of CForm objects.

It's that "almost" that will get you. :)  I have the same thing going on
with a near-1-to-1 mapping between Forms and DAO objects.  I use dynamic
forms, so at least I only write the get/set methods once in the data access
object.  (No Hibernate for me... non JDBC database.)

-- 
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Using ActioForm in ActionForm practice

Posted by Ovidiu EFTIMIE <eo...@gmail.com>.
Hi,
I've recently started working on a project that uses Struts 1.2 and
Hibernate - and I'm in the dev team. Nothing unusual here.
The project architecture is made in such way that ActionForms are an
almost 1-1 mirror with the the Hibernate mapped entities.
For example : if I have an entity A that contains an entity B and a
list of etities C, in the corresponding forms I'll have Aform
containing Bform and a List of CForm objects.

What I would like to know if anyone used the ActionForms in such a way
, or if this is considered to be a best practice.

Thanx,
Ovidiu

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Waiting window with Struts

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
On Tue, May 24, 2005 12:18 pm, Marc Demlenne said:
> The only reason i want to avoid using explicite function call is to be
> more general and lcear and complete. My page contains more links than
> just a submit, and a general solution would be clearer...

Understood.  You could always modify the taglib to emit the code for you,
or if you live in an IE-only world you can use HTCs.  Just some thoughts.

Frank


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Waiting window with Struts

Posted by Marc Demlenne <ma...@gmail.com>.
Ok thanks a lot. I have implemented my wait box nearly like this, in fact.

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

In fact the only thing I'd like to avoid is the necessity to call this
function each time you send your form to activate your wait box. I
wish i could use smthg like <body onload="hidePleaseWait()"
onunload="showPleaseWait()"> to do this for me, but this result of a
wait box only displayed during the short time needed by the new page
display, not the time used by the struts action class, which is always
the most important ...

The only reason i want to avoid using explicite function call is to be
more general and lcear and complete. My page contains more links than
just a submit, and a general solution would be clearer...

Nevertheless, your solution is applicable and helpfull. Thanks ! 

-- 
Marc Demlenne
GPG : 768FA483 (http://pgp.mit.edu)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Waiting window with Struts

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org