orderform.java

来自「网上购物车的JAVA代码实现版」· Java 代码 · 共 67 行

JAVA
67
字号
package feng.shoppingcart.web.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 OrderForm extends ActionForm{
	private String address;
	private String postCode;
	private String email;
	private String homePhone;
	private String cellPhone;
	private String officePhone;
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getPostCode() {
		return postCode;
	}
	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getHomePhone() {
		return homePhone;
	}
	public void setHomePhone(String homePhone) {
		this.homePhone = homePhone;
	}
	public String getCellPhone() {
		return cellPhone;
	}
	public void setCellPhone(String cellPhone) {
		this.cellPhone = cellPhone;
	}
	public String getOfficePhone() {
		return officePhone;
	}
	public void setOfficePhone(String officePhone) {
		this.officePhone = officePhone;
	}
	public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){
		ActionErrors errors=new ActionErrors();
		if((address==null&&postCode==null&&email==null&&homePhone==null&& cellPhone==null&&
				officePhone==null)||
				address.trim().length()==0&&postCode.trim().length()==0&&
				email.trim().length()==0&&homePhone.trim().length()==0&& cellPhone.trim().length()==0&&
				officePhone.trim().length()==0){
			ActionMessage e=new ActionMessage("user.error");
			errors.add("a",e);
		}
		return errors;
	}

}

⌨️ 快捷键说明

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