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

Issue with compound form bean

 
Rob Dennett
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a bean which is backing a form in my code and it contains, conditionally, other beans like so



The controller method that handles posts to the form looks like so (ServiceResponseWrapper is a class we created which we use to pass the result back as JSON):



I am having some problems with this setup. One issue is that mySubBean1.prop1 isn't being validated. The other is that when I do this



the code pukes.

Any thoughts,
Rob
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well lets deal with issue one first, and then see if the second issue persists. The validation framework is not recursive by default which is desirable in some cases. In order to get the behavior you want you need to annotate your sub beans with @Valid.

 
Rob Dennett
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That indeed took care of the first issue. The second issue was caused by a problem in the javascript that resulted in the form being posted normally as opposed to an AJAX post which the code was expecting.

Thanks,
Rob
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic