loginform.java

来自「自己做的BeanUtils 和大家分享。。。 里面还包含了hibernate」· Java 代码 · 共 108 行

JAVA
108
字号
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.0.1/xslt/JavaClass.xslpackage com.yourcompany.struts.form;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;import org.apache.struts.action.ActionMessage;import org.apache.struts.action.ActionMessages;import org.apache.struts.taglib.html.ErrorsTag;public class LoginForm extends ActionForm {	// --------------------------------------------------------- Instance Variables	/** age property */	private Integer age;	/** name property */	private String name;	/** id property */	private Integer id;	public ActionErrors validate(		ActionMapping mapping,		HttpServletRequest request) {						ActionErrors errors = new ActionErrors();//这是1.1的版本		if(id==null){				errors.add("id",new ActionError("login.info"));//1.1的版本用用ActionError,															//如果是1.2的版本的话用ActionMessages															//,ActionMesages是1.2版本才有的,这里用ActionMessage有错误		}else if(name==""){			errors.add("name",new ActionError("login.info"));		}else if(age==null){			errors.add("age",new ActionError("login.info"));		}		return errors;	}	/** 	 * Method reset	 * @param mapping	 * @param request	 */	public void reset(ActionMapping mapping, HttpServletRequest request) {		// TODO Auto-generated method stub	}	/** 	 * Returns the age.	 * @return Integer	 */	public Integer getAge() {		return age;	}	/** 	 * Set the age.	 * @param age The age to set	 */	public void setAge(Integer age) {		this.age = age;	}	/** 	 * 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;	}	/** 	 * Returns the id.	 * @return Integer	 */	public Integer getId() {		return id;	}	/** 	 * Set the id.	 * @param id The id to set	 */	public void setId(Integer id) {		this.id = id;	}}

⌨️ 快捷键说明

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