I'm working on an existing application that uses Struts 1.3.8. Throughout the code the original developer used LazyValidatorForm and he built these assembler classes that takes a LazyValidatorForm and a JavaBean and sets the bean properties into the LazyValidatorForm object. So something like:
Some of this assembler code is hundreds of lines long depending on the complexity of the model being used in the form. Is there a better/simpler way to do this? I haven't had to mess with struts in years so I am a bit rusty but I don't remember ever having to do this. [ October 01, 2008: Message edited by: Gregg Bolinger ]
I personally never used LazyValidatorForm largely because of the issue you raised that they require a lot of ugly code to get data into and out of such a bean. I doubt, though, that it would be worth refactoring the application unless you're doing major revisions to it anyway.
If I were writing such an application from scratch, I'd just code regular JavaBeans that extend ActionForm and then use Apache Commons BeanUtils to copy the properties to and from the model objects. I don't believe that the BeanUtils copyProperties method will work on a LazyValidatorForm.