loginform.java

来自「《jsp网络编程技术与实例》」· Java 代码 · 共 42 行

JAVA
42
字号
package examples;
import org.apache.struts.action.*;import javax.servlet.http.HttpServletRequest;public class LoginForm extends ActionForm {    private String username;    private String password;    public void setUsername(String username) {        this.username = username;    }    public String getUsername() {        return this.username;    }    public String getPassword() {        return this.password;    }    public void setPassword(String password) {        this.password = password;    }    public ActionErrors validate(ActionMapping mapping,                                 HttpServletRequest request) {        ActionErrors errors = new ActionErrors();        if ((username == null) || (username.length() < 1))            errors.add("username",new ActionError("error.username.required"));        if ((password == null) || (password.length() < 1))            errors.add("password",new ActionError("error.password.required"));	if (errors.isEmpty())	    return null;	else	    return errors;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?