Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LazyValidatorForm

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic