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

📄 registerform.java

📁 基于JAVA的一个注册系统 最初只是为了公司做演示使用
💻 JAVA
字号:
package registerapp;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;

/*
* @author ye fei
* @version 1.00, 2003/04/15
* @copyright www.studyjava.com
*/
public class RegisterForm extends ActionForm {
  protected String username;
  protected String password1;
  protected String password2;
  protected String usersex;
  protected String email;

  /**
   * get Password,return a String.
   */
  public String getUserName () {return this.username;};

  /**
   * get Password1,return a String.
   */
  public String getPassword1() {return this.password1;};

  /**
   * get Password2,return a String.
   */
  public String getPassword2() {return this.password2;};

  /**
   * get User sex,return a String.
   */
  public String getUserSex() {return this.usersex;};

  /**
   * set User Email.
   */
  public void setUserEmail(String userEmail){
          this.email=userEmail;
  }

  /**
   * get email,return a String.
   */
  public String getUserEmail(){
          return email;
  }

  /**
   * set User name.
   */
  public void   setUserName (String username) {this.username = username;};

  /**
   * set Password1
   */
  public void   setPassword1(String password) {this.password1 = password;};

  /**
   * set Password2.
   */
  public void   setPassword2(String password) {this.password2 = password;};

  /**
   * set User sex.
   */
  public void   setUserSex(String usersex) {this.usersex = usersex;};


  /**
   * Validate the request parameters specified by  user
   */
  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 ((password1 == null) || (password1.length() < 1))
             errors.add("password1", new ActionError("error.password.required"));

         if ((password2 == null) || (password2.length() < 1))
             errors.add("password2", new ActionError("error.password2.required"));
         else
         if ((password1== null) || (password1.length() < 1 || !password1.equals(password2)))
             errors.add("password2", new ActionError("error.password.match"));

         if ((usersex == null) || (usersex.length() < 1))
             errors.add("usersex", new ActionError("error.usersex.required"));

         if ((email == null) || (email.length() < 1))
             errors.add("email", new ActionError("error.email.required"));

         return errors;
  }
}

⌨️ 快捷键说明

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