You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Graham <dg...@hotmail.com> on 2002/10/15 02:19:16 UTC

[OT] RE: Best practices using value objects

Regardless of the number of attributes you want to edit, you still need a 
map backed attribute if you want to edit many records from the same screen.  
Also, if only one student can be president, you'll want to use a radio 
button instead of a checkbox.  Try using map backed attributes and let us 
know if you need more info.

Dave


>From: <sr...@wipsi.com>
>Reply-To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>Subject: RE: Best practices using value objects
>Date: Mon, 14 Oct 2002 18:14:19 -0400
>
>I want to modify every student, not for every attribute but only a checkbox
>and a text field for example. Thanks for the link. I was thinking of using
>nested form but I do not know how to populated those. I guess the 
>map-backed
>actionForms would work but I thought there was a better way. It is just two
>attributes in a form mapping two attributes of my child value objects.
>I will think about this a little more.
>
>Stephan
>
>-----Message d'origine-----
>De : David Graham [mailto:dgraham1980@hotmail.com]
>Envoyé : 14 octobre, 2002 17:46
>Ŕ : struts-user@jakarta.apache.org
>Objet : RE: Best practices using value objects
>
>It's not clear to me what you're trying to do.  On your jsp, can you edit
>every student or just one?  If it's every student you need map backed form
>attributes; if it's just one student you can use normal form attributes.
>
>See section 4.2.2:
>http://jakarta.apache.org/struts/userGuide/building_controller.html
>
>Dave
>
>
> >From: "stroy@wipsi.com" <sr...@wipsi.com>
> >Reply-To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> >To: <st...@jakarta.apache.org>
> >Subject: RE: Best practices using value objects
> >Date: Mon, 14 Oct 2002 17:50:15 -0400
> >
> >Thanks but I still does not understand what to do with the attributes
> >representing a list of other value objects. I will have to write two
> >converters for each VO in the tree. Is that it or am I missing something?
> >
> >Stephan
> >
> >-----Message d'origine-----
> >De : David Graham [mailto:dgraham1980@hotmail.com]
> >Envoyé : 14 octobre, 2002 14:32
> >Ŕ : struts-user@jakarta.apache.org
> >Objet : Re: Best practices using value objects
> >
> >You can use BeanUtils.copyProperties to copy properties between forms and
> >value beans.  Dynamic forms have nothing to do with this.  Your form 
>could
> >be dynamic or static.  I would only add properties to the value bean if 
>it
> >ends up in the database.
> >
> >Also, it's best practice to not use Vector.  Your variable should be of
> >type
> >List and implemented with ArrayList instead of Vector.
> >
> >Dave
> >
> >
> > >From: Roy.Stephan@hydro.qc.ca
> > >Reply-To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > >To: struts-user@jakarta.apache.org
> > >Subject: Best practices using value objects
> > >Date: Mon, 14 Oct 2002 11:48:25 -0400
> > >
> > >"Best practices using value objects"
> > >
> > >I still have questions regarding best practices, the use value object 
>and
> > >of
> > >the <beanutil> package. How would you convert a value object to a form
> >bean
> > >if a property of the VO is a list of other object that would need to be
> > >converted to a form?
> > >Here is an example of what I am trying to do. I have value objects 
>coming
> > >from the business tier.
> > >
> > >   VOSchool
> > >String address
> > >Vector students
> > >
> > >   VOStudent
> > >String name
> > >int status
> > >boolean isPresident
> > >Vector courses
> > >
> > >I have a page with a lists of all students names, a radio button to
> > >indicate
> > >if he is the president and a checkbox that changed the status  is
> >selected.
> > >
> > >I think I need a StudentForm with all the info from the VO plus a 
>boolean
> > >isSelected property. My SchoolForm need all info from the VO plus a
> > >president property.
> > >
> > >-      How can I best reuse by VOs?
> > >-      Should I add a property to the VOs? How?
> > >-      Are the forms dynamic forms?
> > >-      Should I copy all attributes form the VO to a form?
> > >-      Do I need to write a converter for all my VOs, VO to form and 
>form
> > >to VO?
> > >
> > >I think it is a very common problem but I was not able to find a pretty
> > >solution nor an example on how to do this.
> > >
> > >Thanks
> > >Stephan
> > >
> > >
> > >
> >
> >
> >
> >
> >_________________________________________________________________
> >Chat with friends online, try MSN Messenger: http://messenger.msn.com
> >
> >
> >--
> >To unsubscribe, e-mail:
> ><ma...@jakarta.apache.org>
> >For additional commands, e-mail:
> ><ma...@jakarta.apache.org>
>
>
>
>
>_________________________________________________________________
>Join the world's largest e-mail service with MSN Hotmail.
>http://www.hotmail.com
>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   
><ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>