On 7/5/05, Rick Reumann <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to