简体   繁体   中英

Spring MVC validation with Annotations

I'm having quite some trouble since I migrated my controllers from classical inheritance to use the annotations like @Controller and @RequestMapping. The problem is that I don't know how to plug in validation like in the old case. Are there any good tutorials about this?

Have a look at §13.11.x of the Spring MVC documentation . It covers annotation-based controller configuration, including data binding. It should be very useful to you.

Good luck!

Spring 3 includes improved support for validation, and in particular, JSR-303 validation. You can validate form beans using the @Valid annotation and . See

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/validation.html#validation-beanvalidation

section 5.7.

在紧要关头,总有这样的事情: http//annovalidator.sourceforge.net/ - 它全都是使用注释进行验证,并且设计用于Spring。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM