struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <hus...@apache.org>
Subject Re: STRUTS and EJB
Date Thu, 23 Aug 2001 21:07:43 GMT
I just updated the "Struts-Simple" example to demonstrate using nested
beans in ActionForms and also with bean:write

http://husted.com/about/struts/resources.htm#new

Using a nested bean on your ActionForm lets you use the form like a
wrapper, so you don't have to define everything twice, if your business
beans and ActionForm beans would otherwise be identical.


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/about/struts/


> Derek Longmuir wrote:
> 
> <html:text property="valueObjectA.someNumber" size="5" maxlength="5"
> />
> 
> Where the form has a Value object ValueObjectA, along with a "public
> ValueObjectA getValueObjectA()" method. The value object has a String
> someNumber in it, with a "public String getSomeNumber()" method.
> 
> Doesn't one of the sample applications or Ted's examples show this a
> lot better?
> 
> Derek.
> 
> -----Original Message-----
> From: Narayan, Anand [mailto:ANarayan@Juniper.com]
> Sent: Thursday, August 23, 2001 1:47 PM
> To: 'struts-user@jakarta.apache.org'
> Subject: RE: STRUTS and EJB
> 
> If a value object is used within the ActionForm for holding the form
> data,
> how should the html elements be named so that the data elements in the
> value object
> is automatically populated.  Or should the data elements also reside
> in the ActionForm as
> separate fields, for which the setters and getters would go and get
> the information from the value object ?
> Anand Narayan
> 
> -----Original Message-----
> From: Derek Longmuir [mailto:dlongmuir@echoworx.com]
> Sent: Thursday, August 23, 2001 1:46 PM
> To: 'struts-user@jakarta.apache.org'
> Subject: RE: STRUTS and EJB
> 
> Why not make a Value object for passing the information around, and
> have the form hold an instance of the value object?
> 
> Derek.
> -----Original Message-----
> From: Juha Paananen [mailto:juha.paananen@rtse.com]
> Sent: Thursday, August 23, 2001 1:47 PM
> To: struts-user@jakarta.apache.org
> Subject: RE: STRUTS and EJB
> 
> I also agree on that stuff that has references to STRUTS should not be
> 
> transmitted to the EJB level. The problem here is simply that I would
> not want to make another, exactly similar (except "extends
> ActionForm"),
> class for transporting the information to the EJB. Of course, I can do
> 
> that, but I don't like the idea. My question is, is this inheritance
> of
> ActionForm really necessary in Struts design?
> > -----Original Message-----
> > From: Ted Husted [mailto:husted@apache.org]
> > Sent: 23. elokuuta 2001 20:29
> > To: struts-user@jakarta.apache.org
> > Subject: Re: STRUTS and EJB
> >
> >
> > I agree with Gregor. The ActionForm beans are best left as
> ActionForm
> > beans, and used only as an extension of the html:form tags. Once the
> 
> > data is validated, it should be transferred to persistent
> > stoarge, or to
> > another bean that is not bound to the HTTP layer (and could be
> re-used
> > in other environments). This bean can then use the right data-type
> for
> > the job, and perform other business tasks that have nothing to do
> with
> > gathering input from HTTP.
> >
> > On the way back, a good way to repopulate an ActionForm bean, or
> other
> > string-based helper, is to have your data access objects return a
> Map,
> > and then use it with the standard BeanUtils.populate() method.
> Struts
> > does the same thing with the HTTP request, which is basically a Map.
> 
> >
> > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > -- Custom Software ~ Technical Services.
> > -- Tel +1 716 737-3463
> > -- http://www.husted.com/about/struts/
> >
> > Gregor Rayman wrote:
> > >
> > > "Juha Paananen" <juha.paananen@rtse.com> wrote:
> > >
> > > > I want to fill in a form JavaBean using a struts form, and after
> 
> > > > validating it in my Action class, store it into the db
> > using a session
> > > > EJB component. The proble here is that I have to extend
> > ActionForm class
> > > > to make the bean work with Struts.
> > >
> > > You can use containment instead of inheritance. You should
> > avoid using
> > > Struts ActionForm on the business logic level.
> > >
> > > --
> > > gR

Mime
View raw message