aspose file tools*
The moose likes Spring and the fly likes Issue with compound form bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Issue with compound form bean" Watch "Issue with compound form bean" New topic
Author

Issue with compound form bean

Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
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

Joined: Mar 07, 2010
Posts: 1680
    
    7

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.



[How To Ask Questions][Read before you PM me]
Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with compound form bean