loginform.java

来自「STRUTS的简单例子.用户登陆例子,初学者看!包括源码!」· Java 代码 · 共 98 行

JAVA
98
字号
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.1/xslt/JavaClass.xslpackage com.yourcompany.struts.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: 04-03-2008 *  * XDoclet definition: * @struts.form name="loginForm" */public class LoginForm extends ActionForm {	// --------------------------------------------------------- Instance Variables	/** password property */	private String password;	/** name property */	private String name;	// --------------------------------------------------------- Methods	/** 	 * Method validate	 * @param mapping	 * @param request	 * @return ActionErrors	 */	public ActionErrors validate(		ActionMapping mapping,		HttpServletRequest request) {		ActionErrors errors=new ActionErrors();		if(this.name==null||"".equals(this.name))		{			errors.add("name",new ActionMessage("name.null")) ;		}		if(this.password==null||"".equals(this.password))		{			errors.add("name",new ActionMessage("password.null")) ;		}		return errors;	}		/** 	 * Method reset	 * @param mapping	 * @param request	 */	public void reset(ActionMapping mapping, HttpServletRequest request) {		// TODO Auto-generated method stub	}	/** 	 * 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 name.	 * @return String	 */	public String getName() {		return name;	}	/** 	 * Set the name.	 * @param name The name to set	 */	public void setName(String name) {		this.name = name;	}}

⌨️ 快捷键说明

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