SpringMVC之编程式校验

1.编程式效验需要实现Validator接口,针对模型类进行校验
2.jar包

SpringMVC之编程式校验

3.项目测试结构

SpringMVC之编程式校验

4.StudentModel.java(模型类)

SpringMVC之编程式校验

SpringMVC之编程式校验

1 package com.wt.entity; 2 3 public class StudentModel { 4 private String name; 5 private String pwd; 6 private int age; 7 public String getName() { 8 return name; 9 } 10 public void setName(String name) { 11 this.name = name; 12 } 13 public String getPwd() { 14 return pwd; 15 } 16 public void setPwd(String pwd) { 17 this.pwd = pwd; 18 } 19 public int getAge() { 20 return age; 21 } 22 public void setAge(int age) { 23 this.age = age; 24 } 25 26 }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpjzsz.html