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

📄 loginform.java

📁 自己做的BeanUtils 和大家分享。。。 里面还包含了hibernate 大家可以对比对比
💻 JAVA
字号:
//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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -