tag:blogger.com,1999:blog-3237724005744642470.post6194590093546050343..comments2018-12-15T03:44:33.999+00:00Comments on Captain Debug's Blog: Applying a Custom Spring Validator to a Spring MVC ControllerRoger Hugheshttp://www.blogger.com/profile/07042290171112551665[email protected]Blogger5125tag:blogger.com,1999:blog-3237724005744642470.post-59935556889511499122013-04-09T18:13:10.659+01:002013-04-09T18:13:10.659+01:00Hi Roger,Thanks For The Prompt Reply.I Will Dig Mo...Hi Roger,Thanks For The Prompt Reply.I Will Dig More Info.<br /><br />P.S: Sorry Again For Caps My Phone Just Decide To Caps Every Word.Anonymous[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-53202072474734406382013-04-08T21:15:57.393+01:002013-04-08T21:15:57.393+01:00Thanks for the comment. I should think that you co...Thanks for the comment. I should think that you could do what you want using JSR303. You can find more on JSR303 starting <a href="/2011/07/writng-jsr-303-custom-constraint_26.html#.UWMjRcu9KSM" rel="nofollow">here</a> or simply entering JSR303 in the top right corner of the screen.Roger Hugheshttps://www.blogger.com/profile/07042290171112551665[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-41061832835342917902013-04-08T00:25:25.025+01:002013-04-08T00:25:25.025+01:00Great Info. However, My Scenario Is Slightly Diffe...Great Info.<br />However, My Scenario Is Slightly Different.<br />I Need I Validate An Info Object.<br />IndiA<br />Hierarchy Of Info<br />&gt;InfoA<br />&gt;&gt;InfoA1<br />&gt;&gt;InfoA2<br />&gt;InfoB<br />&gt;&gt;InfoBA<br />&gt;&gt;InfoBB<br /><br />That&#39; Assume That Info Have 20 Attribues, But That&#39;s Only Consider AttOne And AttTwo, AttThree<br />AttOne, AttThree Is Mandatory To InfoA But Optional To InfoB. AttTwo Is mandatory For InfoA1 And InfoB.<br /><br />Is It Possible To Make Use Of TheJSR303?<br />Sorry For The Caps.<br />Thanks.<br />Anonymous[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-87069309104451881282012-07-24T13:16:32.910+01:002012-07-24T13:16:32.910+01:00Hi Anonymous Yes you can use this validator to val...Hi Anonymous<br />Yes you can use this validator to validate several classes. One way of achieving this would be to use a bit of reflection in the <br /><br /> public void validate(Object obj, Errors errors)<br /><br />method to determine the class type. You can then cast the Object accordingly and do the validation.<br /><br />Have you looked at JSR 303? It may not be suitable for your business case, but if it is then it&#39;ll make life easier.Roger Hugheshttps://www.blogger.com/profile/07042290171112551665[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-43203120307979156062012-07-24T10:36:33.598+01:002012-07-24T10:36:33.598+01:00Great blog!! I am wondering if it is possible to c...Great blog!! I am wondering if it is possible to create a custom validator like this one for several classes? Or do I need to create one for each class? Thank youAnonymous[email protected]