<!-- 配置方法级别的校验 -->
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel,browse</param>
<param name="validateAnnotatedMethodOnly">true</param>
</interceptor-ref>
所以action中的这四个方法不需要验证
// 保存
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "admin.username", message = "用户名不允许为空!"),
@RequiredStringValidator(fieldName = "admin.password", message = "密码不允许为空!"),
@RequiredStringValidator(fieldName = "admin.email", message = "E-mail不允许为空!")
},
requiredFields = {
@RequiredFieldValidator(fieldName = "admin.isAccountEnabled", message = "是否启用不允许为空!")
},
stringLengthFields = {
@StringLengthFieldValidator(fieldName = "admin.username", minLength = "2", maxLength = "20", message = "用户名长度必须在${minLength}到${maxLength}之间!"),
@StringLengthFieldValidator(fieldName = "admin.password", minLength = "4", maxLength = "20", message = "密码长度必须在${minLength}到${maxLength}之间!")
},
emails = {
@EmailValidator(fieldName = "admin.email", message = "E-mail格式错误!")
},
regexFields = {
@RegexFieldValidator(fieldName = "admin.username", expression = "^[0-9a-z_A-Z\u4e00-\u9fa5]+$", message = "用户名只允许包含中文、英文、数字和下划线!")
}
)