personform.java

来自「近几年来」· Java 代码 · 共 85 行

JAVA
85
字号
package tarena.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; public class PersonForm extends ActionForm {	private Integer id;	private String password;	private String name;	private String flag;		public String getFlag() {		return flag;	}	public void setFlag(String flag) {		this.flag = flag;	}	public ActionErrors validate(		ActionMapping mapping,		HttpServletRequest request) {		ActionErrors errors = new ActionErrors();		if(name==null||name.trim().length()<1) {			errors.add("info.name", new ActionMessage("info.name"));		}		if(password==null||password.trim().length()<1) {			errors.add("info.password", new ActionMessage("info.password"));		}				return errors;	}	public void reset(ActionMapping mapping, HttpServletRequest request) {		name="";		password="";		id = 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 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;	}	public Integer getId() {		return id;	}	public void setId(Integer id) {		this.id = id;	}}

⌨️ 快捷键说明

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