I just committed some changes which enable "Lazy" DynaBean to be easily plugged into Struts.
"Lazy" DynaBeans have been added to Commons BeanUtils and are due to be released in BeanUtils 1.7.0 which has just been voted on. Docs for LazyDynaBeans can be found here: http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/package-summary.html#dynamic.lazy The changes I made are as follows: * BeanValidatorForm - I added this new class. It extends ValidatorForm and acts as a "wrapper" around a DynaBean - like DynaValidatorForm - but you can plug any type of DynaBean into it - or additionally a POJO bean (it wraps them in a WrapDynaBean). This provides an easy mechanism for creating "Lazy" ActionForm implementations. * RequestUtils - I changed the populate method to ignore parameters which start with "org.apache.struts." - things like "org.apache.struts.action.CANCEL" cause Lazy implementations of ActionForms problems as BeanUtils.populate() fails trying to retrieve a bean called "org" - ignoring these type of internal struts attributes in ActionForm population removes this issue. * FormBeanConfig - I changed the createActionForm method to initialize properties for ActionForms which are DynaBeans with a MutableDynaClass (which "Lazy" ActionForm implementations will be). * FormBeanConfig - I added a "restricted" property which can be use to "restrict" a MutableDynaClass for ActionForms which are DynaBeans with a MutableDynaClass. * FormBeanConfig - I changed the createActionForm so that if the "type" is not an ActionForm (i.e. its a POJO bean) it creates a BeanValidatorForm which uses a WrapDynaBean to "wrap" the "type" specified. I guess this could be contentious as it effectively allows any kind of bean to be plugged in as the ActionForm. I haven't added "Lazy" ActionForm implementations to Struts as that would require depending on BeanUtils 1.7.0 - but I have four flavours on my web site here: http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean As you can see theres not actually that much too them now - most of their behaviour is either in the LazyDynaBeans in BeanUtils or the BeanValidatorForm that I just added to Struts. I'm guessing its too late in the day to release these in the upcoming Struts 1.2.2 release, although if the change I made to RequestUtils could go in, it would remove a real obstacle to using Lazy ActionForms with Struts 1.2.2 - the other changes can easily be plugged in by a user. Feedback welcome. Niall --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
