On Tue, 7 Jan 2003, Rene Eigenheer wrote:
> Date: Tue, 7 Jan 2003 22:19:00 +0100 > From: Rene Eigenheer <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> > Subject: ConvertUtils, BeanUtils > > Craig, > > I use the opportunity to jump into this and to ask you and everybody here > for an advice: > > I try to follow the good practice to have only Strings within the > form-classes and having value objects with the correct types. > > In the past I coded the copy from vo to form and vice-versa with the typical > setter-getter for every field - easy but sometimes painfull. > > Recently I've started using BeanUtils to copy the properties, I even ;-))) > managed it to register my own converter for GregorianCalendar properties. > Smart move :-). > Now my two questions/problems: > > question 1: > where do i need to register the converter in a struts web-application? once > in a plugin? within the the controller? within every action? > The registration is global to your entire commons-beanutils.jar file, so I'd probably do this in a PlugIn. It only needs to be done once. > problem/question 2: > when i have the typical situation of vaqlue object "invoice" having an > ArrayList of value objects "invoice position" and having a form "invoice" > with an ArrayList of "subforms" "invoice position", then the copyProperties > works fine for the vo-invoice to form-invoice but it copes the > vo-invoice-positions to the ArrayList of the form-invoice. I'm afraid that I don't understand what you are saying here. Could you illustrate the problem wish some simple examples from your VO and form bean declarations? > is there a solution for this problem? > is there a possibility to ask the converter not to convert collections? > what is a good practice to manage this? > > > -Rene Craig -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>