📄 u01studentformvalid.java
字号:
package cn.hope.front.form.validation;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.validator.Field;
import org.apache.commons.validator.GenericValidator;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.util.ValidatorUtils;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.validator.Resources;
public class U01StudentFormValid {
public static boolean twoPsw(Object bean, ValidatorAction va, Field field,
ActionMessages errors, HttpServletRequest request) {
String value = ValidatorUtils.getValueAsString(bean, field
.getProperty());
try {
if (!GenericValidator.isBlankOrNull(value)) {
if (!GenericValidator.isBlankOrNull(request
.getParameter("psw1"))) {
if (!value.equals(request.getParameter("psw1"))) {
errors.add(field.getKey(), Resources.getActionMessage(request, va,
field));
return false;
}
}
}
} catch (Exception e) {
errors.add(field.getKey(), Resources.getActionMessage(request, va,
field));
return false;
}
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -