📄 registerform.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -