Subject: Re: ActionForms With Dynamic Properties
Date: Fri, 17 Aug 2001 18:17:16 +0200
From: "Jan Sorensen" <jan.sorensen@aragost.com>
To: <struts-dev@jakarta.apache.org>, "Oleg V Alexeev" <oalexeev@apache.org>,
<jakarta-commons@jakarta.apache.org>
I downloaded the latest build of Struts to make my changes to the files
there. I have only changes the classes BeanUtils and PropertyUtils, which I
then realized have been move to the commons project, the reason I also send
this mail to the commons mailing list.
In addition to the changes, I have also created two new classes which I have
moved to the org.apache.commons.beanutils package.
In the attached file there is the two changed classes, and the two new
classes, plus a small demo struts app with three jsp's and a single action
form (of course with dynamic properties).
I have create an interface beans with dynamic properties must implement,
there is one method that returns a DynamicPropertyDescriptor (subclass of
PropertyDescriptor) given a property name (null if the name isn't a dynamic
property).
In PropertyUtils I changed the getSimpleProperty and setSimpleProperty check
if the property is dynamic and then call getDynamicProperty or
setDynamicProperty.
In BeanUtils i have changed the getPropertyDescriptor to return
DynamicPropertyDescriptor in case of a dynamic property.
With these changes is Struts works fine with dynamic properties. I have not
tested with indexed and nested properties, but believe I would work.
Regards,
Jan Sorensen
aragost