📄 assetform.java
字号:
package com.qrsx.appcam.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 AssetForm extends ActionForm {
private String id; // 主键
private String code; // 代码
private String name; // 资产名称
private String assetTypeId; // 类型编号
private String model; // 型号
private String clientId; // 生产厂家
private String leaveFactoryDate;// 出厂日期
private String buyDate; // 购买日期
private String life; // 预计使用年限
private String price; // 价格
private String storageId; // 所属仓库
private String addTypeId; // 增加方式
private String state; // 使用状态
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
// 资产类型、名称、生产厂家 不能为空
if (code == null || code.trim().length() == 0) {
errors.add("code", new ActionMessage("assetForm.code.required"));
}
if (name == null || name.trim().length() == 0) {
errors.add("code", new ActionMessage("assetForm.code.required"));
}
if (clientId == null || clientId.trim().length() == 0) {
errors.add("clientId", new ActionMessage(
"assetForm.clientId.required"));
}
// 使用年限必须为整数类型
if (life != null && life.trim().length() > 0) {
try {
Integer.valueOf(life);
} catch (Exception e) {
e.printStackTrace();
errors.add("life", new ActionMessage("assetForm.life.Integer"));
}
}
// 价格必须为浮点型
if (price != null && price.trim().length() > 0) {
try {
Double.valueOf(price);
} catch (Exception e) {
e.printStackTrace();
errors
.add("price", new ActionMessage(
"assetForm.price.Double"));
}
}
return errors;
}
/**
* @return the addTypeId
*/
public String getAddTypeId() {
return addTypeId;
}
/**
* @param addTypeId
* the addTypeId to set
*/
public void setAddTypeId(String addTypeId) {
this.addTypeId = addTypeId;
}
/**
* @return the assetTypeId
*/
public String getAssetTypeId() {
return assetTypeId;
}
/**
* @param assetTypeId
* the assetTypeId to set
*/
public void setAssetTypeId(String assetTypeId) {
this.assetTypeId = assetTypeId;
}
/**
* @return the buyDate
*/
public String getBuyDate() {
return buyDate;
}
/**
* @param buyDate
* the buyDate to set
*/
public void setBuyDate(String buyDate) {
this.buyDate = buyDate;
}
/**
* @return the clientId
*/
public String getClientId() {
return clientId;
}
/**
* @param clientId
* the clientId to set
*/
public void setClientId(String clientId) {
this.clientId = clientId;
}
/**
* @return the code
*/
public String getCode() {
return code;
}
/**
* @param code
* the code to set
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the leaveFactoryDate
*/
public String getLeaveFactoryDate() {
return leaveFactoryDate;
}
/**
* @param leaveFactoryDate
* the leaveFactoryDate to set
*/
public void setLeaveFactoryDate(String leaveFactoryDate) {
this.leaveFactoryDate = leaveFactoryDate;
}
/**
* @return the life
*/
public String getLife() {
return life;
}
/**
* @param life
* the life to set
*/
public void setLife(String life) {
this.life = life;
}
/**
* @return the model
*/
public String getModel() {
return model;
}
/**
* @param model
* the model to set
*/
public void setModel(String model) {
this.model = model;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the price
*/
public String getPrice() {
return price;
}
/**
* @param price
* the price to set
*/
public void setPrice(String price) {
this.price = price;
}
/**
* @return the state
*/
public String getState() {
return state;
}
/**
* @param state
* the state to set
*/
public void setState(String state) {
this.state = state;
}
/**
* @return the storageId
*/
public String getStorageId() {
return storageId;
}
/**
* @param storageId
* the storageId to set
*/
public void setStorageId(String storageId) {
this.storageId = storageId;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -