📄 orderform.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -