74

在SpringMVC中使用数据验证组件——hibernate-validator-zero

 6 years ago
source link: http://blog.51cto.com/zero01/2090999
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
在做web开发的时候,经常需要对客户端发送过来的数据进行一个验证,以防数据不合法。而SpringMVC支持的数据校验是JSR303的标准,通过在bean的属性上打上annotation@NotNull@Max等注解进行验证。JSR303提供有很多annotation借口,而SpringMVC对于这些验证是使用hibernate的实现,所以我们需要添加hibernate的一个validator包:&

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK