首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

[JAVA]Validator 运用

2012-09-19 
[JAVA]Validator 应用Java validator的应用JavaxAssertFalseAssertTrueDecimalMaxDecimalMinDigitsFutureM

[JAVA]Validator 应用

Java validator的应用

Javax
AssertFalse
AssertTrue
DecimalMax
DecimalMin
Digits
Future
Max
Min
NotNull
Null
Past
Pattern
Size

Hibernate
CompositionType
ConstraintComposition
CreditCardNumber
Email
Length
NotBlank
NotEmpty
Range
SafeHtml
ScriptAssert
URL

?

用法(在pojo定义中)

@Email(message = "邮件地址格式不正确")public String getEmail() {return email;}

?使用

//output the error informationSet<ConstraintViolation<Customer>> violations = validator.validate(customer);//throw the exceptionsValidatorUtils.validateWithException(validator, customer);
?

?

热点排行