spring boot 表单校验

1.在pom中添加依赖:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
 
2.实体中添加过滤条件
 

3.在Controller中添加条件判断

 

 

说明:关于@valid  和 BindingResult类

参考CSDN博客:http://blog.csdn.net/xzmeasy/article/details/76098188

 

posted on 2018-02-09 13:52  chenzx0918  阅读(226)  评论(0编辑  收藏  举报

导航