logonform.java
来自「这是一个基于struts框架的地址薄程序」· Java 代码 · 共 59 行
JAVA
59 行
package addressbook.forms;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
/**
* <strong>LogonForm</strong> handles the form
* that the user will use to logon to the application.
*/
public final class LogonForm extends ActionForm {
private String username = null;
private String password = null;
public String getUserName() {
return (this.username);
}
public void setUserName(String username) {
this.username = username;
}
public String getPassword() {
return (this.password);
}
public void setPassword(String password) {
this.password = password;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.username = null;
this.password = null;
}
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((username == null) || (username.length() < 1))
errors.add("username", new ActionMessage("error.username.required"));
if ((password == null) || (password.length() < 1))
errors.add("password", new ActionMessage("error.password.required"));
return errors;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?