You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rivka Shisman <ri...@nite.org.il> on 2005/07/05 08:10:58 UTC

architecture of composite action forms - please help

Hello Friends,

 

I have a transfer object called FatherTO that contains a collection of
ChildTO's.

Can you please help me with how the relevant ActionForm (i.e. FatherForm
) should look like.

How should the reset() & validate() methods look like?

Should I use the same jsp form for the Father data and it's childs data?

 

Thanks

Rivka
**************************************************************************************************
The contents of this email and any attachments are confidential.
They are intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or  the 
sender immediately and do not disclose the contents to anyone or make copies.

** eSafe scanned this email for viruses, vandals and malicious content. **
**************************************************************************************************

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


Re: architecture of composite action forms - please help

Posted by Michael Jouravlev <jm...@gmail.com>.
On 7/5/05, Rick Reumann <st...@reumann.net> wrote:
> Michael Jouravlev wrote the following on 7/5/2005 1:41 PM:
> > You want to have your TOs populated by Struts? Why would not you just
> > make FatherTO as a member of ActionForm, and use it as nested
> > property? If you want to retain TO values between requests, set form
> > scope to "session".
> 
> Yup. This is what I do. Which ends up making you wonder why do you
> really need an ActionForm at all:) Just have your TO(s)/ValueObjec(s) as
> your ActionForm property(ies).
> 
> The only drawback, of course, to the above is validation. That can get a
> bit messy if you want to use the struts validation stuff (I'm not even
> sure if it's possible?)... but since I don't use it, I don't see much
> problem using your Value Objects directly as ActionForm properties.
> 
> (If I need validation I call my own validation method which validate the
> nested VOs.)

Struts needs two improvements:
* populate properties of an arbitrary bean instead of populating
subclass of ActionForm;
* dispatch request directly into the form bean, so I could return a
mapping from a form bean instead of defining near-empty action class
for that.

A form bean with session scope and with handler methods allows to
create a stateful object like JSF backing bean. For some reason
putting methods in a form bean is frown upon, but actually it is a
great thing.

Validation... I think it should be done in the business/persistence
layer, because application can have other front ends besides Struts.
On the other hand, all request parameters are strings, so TO/VO/BO has
to accept strings and to validate them. Validating input in a form
bean works only for simple apps.

<OT>
What do you call a pattern when you use detached business objects as
transfer objects?
</OT>

Michael.

--
Dialogs for Struts
http://struts.sourceforge.net/strutsdialogs

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


Re: architecture of composite action forms - please help

Posted by Rick Reumann <st...@reumann.net>.
Michael Jouravlev wrote the following on 7/5/2005 1:41 PM:
> You want to have your TOs populated by Struts? Why would not you just
> make FatherTO as a member of ActionForm, and use it as nested
> property? If you want to retain TO values between requests, set form
> scope to "session".

Yup. This is what I do. Which ends up making you wonder why do you 
really need an ActionForm at all:) Just have your TO(s)/ValueObjec(s) as 
your ActionForm property(ies).

The only drawback, of course, to the above is validation. That can get a 
bit messy if you want to use the struts validation stuff (I'm not even 
sure if it's possible?)... but since I don't use it, I don't see much 
problem using your Value Objects directly as ActionForm properties.

(If I need validation I call my own validation method which validate the 
nested VOs.)

-- 
Rick

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


Re: architecture of composite action forms - please help

Posted by Michael Jouravlev <jm...@gmail.com>.
You want to have your TOs populated by Struts? Why would not you just
make FatherTO as a member of ActionForm, and use it as nested
property? If you want to retain TO values between requests, set form
scope to "session".

Michael.

> Rivka Shisman wrote:
> > Hello Friends,
> >
> >
> >
> > I have a transfer object called FatherTO that contains a collection of
> > ChildTO's.
> >
> > Can you please help me with how the relevant ActionForm (i.e. FatherForm
> > ) should look like.
> >
> > How should the reset() & validate() methods look like?
> >
> > Should I use the same jsp form for the Father data and it's childs data?

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


Re: architecture of composite action forms - please help

Posted by Grzegorz Stasica <gs...@poczta.onet.pl>.
Rivka Shisman wrote:
> Hello Friends,
> 
>  
> 
> I have a transfer object called FatherTO that contains a collection of
> ChildTO's.
> 
> Can you please help me with how the relevant ActionForm (i.e. FatherForm
> ) should look like.
> 
> How should the reset() & validate() methods look like?
> 
> Should I use the same jsp form for the Father data and it's childs data?
> 
>  
> 
> Thanks
> 
> Rivka
> **************************************************************************************************
> The contents of this email and any attachments are confidential.
> They are intended for the named recipient(s) only.
> If you have received this email in error please notify the system manager or  the 
> sender immediately and do not disclose the contents to anyone or make copies.
> 
> ** eSafe scanned this email for viruses, vandals and malicious content. **
> **************************************************************************************************

hi,

I'd choose solution with two forms


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