File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes LazyValidatorForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "LazyValidatorForm" Watch "LazyValidatorForm" New topic
Author

LazyValidatorForm

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

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:



And then in the jsp you'd have 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 ]

GenRocket - Experts at Building Test Data
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LazyValidatorForm