⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logonform.java

📁 如题ServletJSP.rar 为网络收集的JSP网站源文件
💻 JAVA
字号:
package org.redsoft.forum.web;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

/**
 * Title:        XP Forum
 * Description:  Logon Form, For Users to login
 * @author Peng, Luo
 * @version 1.0
 * March 26, 2002
 */

public final class LogonForm extends ActionForm {


    private String userName = null;
    private String password = null;
    private boolean autoLogon = false;


    public String getUserName() {
	    return (this.userName);
    }
    public void setUserName( final String username ) {
        this.userName = username;
    }

    public String getPassword() {
	    return (this.password);
    }
    public void setPassword( final String password ) {
        this.password = password;
    }

    public boolean getAutoLogon() {
        return autoLogon;
    }

    public void setAutoLogon( final boolean autoLogon ) {
        this.autoLogon = autoLogon;
    }

    /**
     * Reset all properties to their default values.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {

        this.userName = null;
        this.password = null;
        this.autoLogon = false;
    }


    /**
     * Validate the properties that have been set from this HTTP request,
     * and return an <code>ActionErrors</code> object that encapsulates any
     * validation errors that have been found.  If no errors are found, return
     * <code>null</code> or an <code>ActionErrors</code> object with no
     * recorded error messages.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    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") );
		}else if ( userName.length() > Account.USER_NAME_MAX_LENGTH ){
            errors.add("userName", new ActionError("error.userName.maxlength") );
		}else if ((password == null) || (password.length() < 1)){
            errors.add("password", new ActionError("error.password.required"));
		}else if ( password.length() > Account.PASSWORD_MAX_LENGTH ){
            errors.add("password", new ActionError("error.password.maxlength"));
		}
        return errors;
    }

}//EOC

⌨️ 快捷键说明

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