registerform.java
来自「struts」· Java 代码 · 共 47 行
JAVA
47 行
package com.wiely.struts.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
@SuppressWarnings("serial")
public class RegisterForm extends ActionForm {
String name;
String rpassword;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRpassword() {
return rpassword;
}
public void setRpassword(String rpassword) {
this.rpassword = rpassword;
}
@Override
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((getRpassword().length() < 3) || (getRpassword().length() > 11)) {
errors
.add("rpassword", new ActionMessage(
"errors.password.length"));
}
if (getName().equalsIgnoreCase("") || getName() == null) {
errors.add("name", new ActionMessage("errors.username.required"));
}
return errors;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?