【Java开源代码栏目提醒】:网学会员在Java开源代码频道为大家收集整理了AssetModifyForm.java提供大家参考,希望对大家有所帮助!
/*
* AssetModifyForm.java
*
* Created on 2006年6月10日, 上午10:13
*/
package form.asset;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
*
* @author Administrator
* @version
*/
public class AssetModifyForm extends org.apache.struts.action.ActionForm {
private String name;
private String price;
private String departmentId;
private String typeId;
private String remarks;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getDepartmentId() {
return departmentId;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getTypeId() {
return typeId;
}
public void setTypeId(String typeId) {
this.typeId = typeId;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (getName() == null || getName().equals("")) {
errors.add("name", new ActionMessage("errors.asset.name.required"));
}
if (getPrice() == null || getPrice().equals("")) {
errors.add("price", new ActionMessage("errors.asset.price.required"));
}
if (getDepartmentId() == null) {
errors.add("depId", new ActionMessage("errors.asset.departmentId.required"));
}
if (getTypeId() == null) {
errors.add("typeId", new ActionMessage("errors.asset.typeId.required"));
}
if (getRemarks() == null) {
errors.add("remarks", new ActionMessage("errors.asset.remarks.required"));
}
return errors;
}
}