package com.spring.validate.bean;
import java.util.Date;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
/**
* <p>Project: spring_validate_annotation</p>
* <p>ClassName: User</p>
* <p>Description: </p>
* @author Aric
* @date 2015年12月29日 上午9:07:43
* @version 1.0
*/
public class User {
private long id;
@NotBlank(message="{valid.name}")
private String name;
@Length(min=4, max=20, message="{valid.password}")
private String password;
@NotBlank(message="{valid.required}")
@Email(message="{valid.email}")
private String email;
@NotNull(message="{valid.required}")
private boolean married;
@Min(value=18, message="{valid.ageMin}")
@Max(value=100, message="{valid.ageMax}")
private int age;
@NotNull(message="{valid.required}")
@Past(message="{valid.birthday}")
private Date birthday;
@Pattern(regexp="^[a-zA-Z]{2,}$", message="{valid.address}")
private String address;
@Size(min=1, message="{valid.likesMin}")
private String[] likes;
@com.spring.validate.validator.Tel(message="{valid.tel}", min=3)
private String tel;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public boolean isMarried() {
return married;
}
public void setMarried(boolean married) {
this.married = married;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String[] getLikes() {
return likes;
}
public void setLikes(String[] likes) {
this.likes = likes;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
springmvc_jsr303
共60个文件
jar:24个
class:6个
java:6个
需积分: 10 9 下载量 199 浏览量
2015-12-29
15:46:37
上传
评论
收藏 7.29MB RAR 举报
温馨提示
完成的Maven项目,可在eclipse中通过Existing Maven Projects方式导入该项目,已经过实测. 项目中所需的jar包在压缩包中已提供,项目中用到了JSR303和hibernate-validator的技术,大量采用了注解@NotNull,@Email,@Length,@Max,@Pattern,@Size等,此外还采用了自定义注解,验证信息全部配置在属性文件中.
资源推荐
资源详情
资源评论
收起资源包目录
spring_validate_annotation.rar (60个子文件)
spring_validate_annotation
.project 1KB
src
test
java
main
webapp
WEB-INF
views
TestAnnotationValid
index.jsp 2KB
web.xml 2KB
index.jsp 52B
lib
spring-tx-3.2.5.RELEASE.jar 237KB
spring-oxm-3.2.5.RELEASE.jar 73KB
log4j-1.2.16.jar 470KB
spring-webmvc-3.2.5.RELEASE.jar 622KB
spring-jdbc-3.2.5.RELEASE.jar 396KB
spring-expression-3.2.5.RELEASE.jar 192KB
wicket-request-1.5-RC5.1.jar 72KB
jstl-1.2.jar 405KB
slf4j-log4j12-1.6.1.jar 10KB
spring-aop-3.2.5.RELEASE.jar 328KB
spring-orm-3.2.5.RELEASE.jar 376KB
spring-context-support-3.2.5.RELEASE.jar 125KB
spring-core-3.2.5.RELEASE.jar 850KB
spring-context-3.2.5.RELEASE.jar 845KB
slf4j-api-1.6.1.jar 25KB
spring-web-3.2.5.RELEASE.jar 613KB
wicket-util-1.5-RC5.1.jar 346KB
jsr303-1.5-RC5.1.jar 20KB
aopalliance-1.0.jar 4KB
spring-beans-3.2.5.RELEASE.jar 596KB
wicket-core-1.5-RC5.1.jar 1.49MB
commons-logging-1.2.jar 60KB
hibernate-validator-4.1.0.Final.jar 281KB
validation-api-1.0.0.GA.jar 46KB
resources
messages_en_US.properties 385B
spring.xml 3KB
messages.properties 385B
java
com
spring
validate
converter
IntConverter.java 508B
DateConverter.java 785B
controller
TestAnnotationValidController.java 2KB
validator
TelValidator.java 1KB
Tel.java 777B
bean
User.java 3KB
target
m2e-wtp
web-resources
META-INF
MANIFEST.MF 109B
maven
www.ideal.sh.cn
spring_validate_annotation
pom.properties 270B
pom.xml 4KB
classes
com
spring
validate
converter
DateConverter.class 1KB
IntConverter.class 1KB
controller
TestAnnotationValidController.class 3KB
validator
Tel.class 784B
TelValidator.class 2KB
bean
User.class 3KB
messages_en_US.properties 385B
spring.xml 3KB
messages.properties 385B
test-classes
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.m2e.core.prefs 90B
org.eclipse.jdt.core.prefs 430B
org.eclipse.wst.validation.prefs 50B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.core.resources.prefs 175B
org.eclipse.wst.common.component 803B
.jsdtscope 575B
pom.xml 4KB
.classpath 1KB
共 60 条
- 1
资源评论
Aric_Lv
- 粉丝: 0
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功