By fenrir
via uberwolf.blogspot.com
Published: Jul 06 2009 / 09:56
Spring 2.5.x introduces annotated controller that makes web development with Spring MVC a lot easier. No more XML is required for each controller you define.
Spring MVC's annotated controller reminds me of Ben Parker's famous quote: "With great power comes great responsibility". What's the great responsibility of using the annotated controller? The validation!!
With the old base-controller-classes approach you can just inject validators to your form controller and Spring MVC will take care of the validation for you. With annotated controller, this validation mechanism is removed. The common way to do validation with annotated controller is to inject Validator objects into your annotated controller and use its validate() method on the bean you want to validate.
It's painful to write these validation steps manually in every request method. Luckily, with Spring 2.x's @Aspect, we can write a nice validation mechanism for our annotated controllers.
Tweet
SaveShareSend
Tags: frameworks, how-to, java, open source



Comments
MCII replied ago:
Someone still propagating AspectJ & Spring?
fenrir replied ago:
Hi piccoloprince, I used the (+) Add new link button on top of this screen and just entered everything required ^^
IMHO, you probably missed some required fields.
Voters For This Link (12)
Voters Against This Link (0)