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

📄 loginform.java

📁 一个netstore的完整代码,他使用了j2ee和webservice技术,并使用ojb o/r管理框架,很不错的
💻 JAVA
字号:
package netstore.security;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
/**
 * Form bean for the user signon page.
 */
public class LoginForm extends ActionForm {
  private String password = null;
  private String email = null;

  /**
   * Public accessors and mutators
   */
  public void setEmail(String email) {
    this.email = email;
  }

  public String getEmail() {
    return (this.email);
  }

  public String getPassword() {
    return (this.password);
  }

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

  /**
   * 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(getEmail() == null || getEmail().length() < 1) {
      errors.add( ActionErrors.GLOBAL_MESSAGE,
                  new ActionMessage("global.required", "email" ));
    }
    if(getPassword() == null || getPassword().length() < 1) {
      errors.add( ActionErrors.GLOBAL_MESSAGE,
                  new ActionMessage("global.required", "password" ));
    }
    return errors;
  }

  /**
   * 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.password = null;
    this.email = null;
  }
}

⌨️ 快捷键说明

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