I actually use EJBs for the model objects. I have some non-struts related
JavaBeans that I use for transport objects. These are the beans that I nest
inside Struts action forms. They are passed to EJBs model components. That
way the EJBs have no Struts dependancies and I don't have to duplicate the
JavaBeans in the ActionForm.

The transport JavaBeans don't have any business rules or logic. The business
logic is in session beans and entity beans are used mainly for container
managed persitence. The entity beans typically duplicate the same fields
that are in the transport JavaBeans but the properties are not necessarily
exposed in the remote interface. Not every entity bean has an associate
transport bean and not every struts form has a nested bean. I only use them
for entities with many properties.

I think there is a different term rather than "transport Javabeans" for this
pattern but I forget what it is. It basically allows for methods with fewer
parameters.

You are basically going to have to duplicate the properties in at least two
places or you will tie your model components too closely to your view
components. Another technique for making this a painless as possible is to
use the BeanUtils.copyProperties() method to copy data from the view bean to
the model bean.

Hal



> -----Original Message-----
> From: Mikkel Bruun [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 29, 2001 1:32 PM
> To: Deadman, Hal; '[EMAIL PROTECTED] '
> Subject: RE: action classes
>
>
> Hi Hal,
>
> So you would the ActionForm to contain an instance of the "business
> model"???
>
> thats an intereting approach...tried it in practice???
>
> right now im struggling with some rather large "business
> models" which has
> mostof their attributes duplicated in the action form...
>
> Mikkel
>
> -----Original Message-----
> From: Deadman, Hal
> To: [EMAIL PROTECTED]
> Sent: 29-05-2001 15:49
> Subject: RE: action classes
>
> Struts allows you to nest your existing beans inside the form
> class. You
> won't need to duplicate the get/set methods. You reference the nested
> beans
> with dot notation. There are examples of this in the
> html-setters.jsp in
> the
> excercise-taglib webapp that comes with struts.
>
> > -----Original Message-----
> > From: Neil Blue [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, May 26, 2001 8:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: action classes
> >
> >
> > Hello,
> >
> > I am extending the ActionForm class to create my own bean
> > Form classes.
> > However I already have my own set of beans with all the getter and
> > setter methods that the Form class will need. Does anyone
> > know if there
> > are any plans to make ActionForm etc, interfaces, as I would
> > rather not
> > change the basic struts package.
> >
> > Cheers
> > Neil
> >
>

Reply via email to