loginform.java
来自「教你一天学会struts」· Java 代码 · 共 103 行
JAVA
103 行
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.soft136.strutsoneday.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
* MyEclipse Struts Creation date: 03-18-2008
*
* XDoclet definition:
*
* @struts.form name="loginForm"
*/
public class LoginForm extends ActionForm {
/*
* Generated fields
*/
/** password property */
private String password;
/** username property */
private String username;
/*
* Generated Methods
*/
/**
* Method validate
*
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (username == null || username.length() < 1) {
errors.add("login", new ActionMessage("login.nousername.error"));
}
if (password == null || password.length() < 6) {
errors.add("login", new ActionMessage("login.nopassword.error"));
}
return errors;
}
/**
* Method reset
*
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
username = "";
// checkbox1 = false;
// password = null;
}
/**
* Returns the password.
*
* @return String
*/
public String getPassword() {
return password;
}
/**
* Set the password.
*
* @param password
* The password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Returns the username.
*
* @return String
*/
public String getUsername() {
return username;
}
/**
* Set the username.
*
* @param username
* The username to set
*/
public void setUsername(String username) {
this.username = username;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?