郁闷中的一个问题
2010-01-10 18:31
405 查看
最近开发的时候碰了一个问题,思索多日也不见答案,今日将问题贴于此,望高手能指出我这初出茅庐的错误:
使用的框架SSH
三个model:
public class StorageInvoices {
private String storageId;
private String name;//产品名称
private StorageType storageType;//产品类别
private int amount;//数量
private Unit unit;//单位
private String inputTime;//入库时间
private String model;//产品型号
private String dealperson;//入库经手人
private String remark;//备注
//库存
private int amount2;//库存数量
// 出库单
private int amount3;//出库数量
private String outperson;//出库经手人
private String remarks;//出库备注
private String stateId; //状态Id
private State state;//状态
public String getStorageId() {
return storageId;
}
public void setStorageId(String storageId) {
this.storageId = storageId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public Unit getUnit() {
return unit;
}
public void setUnit(Unit unit) {
this.unit = unit;
}
public String getInputTime() {
return inputTime;
}
public void setInputTime(String inputTime) {
this.inputTime = inputTime;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getDealperson() {
return dealperson;
}
public void setDealperson(String dealperson) {
this.dealperson = dealperson;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public StorageType getStorageType() {
return storageType;
}
public void setStorageType(StorageType storageType) {
this.storageType = storageType;
}
public String getStateId() {
return stateId;
}
public void setStateId(String stateId) {
this.stateId = stateId;
}
public State getState() {
return state = State.getStateById(stateId);
}
public void setState(State state) {
this.state = state;
}
public int getAmount2() {
return amount2;
}
public void setAmount2(int amount2) {
this.amount2 = amount2;
}
public int getAmount3() {
return amount3;
}
public void setAmount3(int amount3) {
this.amount3 = amount3;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getOutperson() {
return outperson;
}
public void setOutperson(String outperson) {
this.outperson = outperson;
}
}
它的action:
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import net.jcreate.e3.table.DataModel;
import net.jcreate.e3.table.NavRequest;
import net.jcreate.e3.table.html.HTMLTableHelper;
import com.nxyl.cmpm.warehouse.model.State;
import com.nxyl.cmpm.warehouse.model.StorageInvoices;
import com.nxyl.cmpm.warehouse.model.StorageType;
import com.nxyl.cmpm.warehouse.model.Unit;
import com.nxyl.cmpm.warehouse.service.StorageInvoicesService;
import com.nxyl.cmpm.warehouse.service.StorageTypeService;
import com.nxyl.cmpm.warehouse.service.UnitService;
import com.nxyl.common.AbstractAction;
import com.opensymphony.xwork2.ActionContext;
public class StorageInvoicesAction extends AbstractAction {
private StorageInvoicesService storageInvoicesService;
private StorageTypeService storageTypeService;
private UnitService unitService;
private StorageInvoices storageInvoices;
private List storageInvoicesList;
private DataModel dataModel;
private String storageId;
private String storageTypeId;
private String unitId;
private int amount;
private int amount2;
/**
* 编辑
* **/
public String load() throws Exception {
if(storageId==null){
this.setMotion("create");
}else {
this.setMotion("edit");
storageInvoices=storageInvoicesService.getStorageInvoices(storageId);
}
return SUCCESS;
}
/***
* 保存
* */
public String save() throws Exception {
StorageType storageType = storageTypeService.getStorageType(storageTypeId);
storageInvoices.setStorageType(storageType);
Unit unit = unitService.getUnit(unitId);
storageInvoices.setUnit(unit);
if("edit".equalsIgnoreCase(this.getMotion()) && storageId != null){
storageInvoicesService.updateStorageInvoices(storageInvoices);
}else{
storageInvoices.setStateId(State.getNO_STOR().getStateId());
storageInvoicesService.createStorageInvoices(storageInvoices);
}
return SUCCESS;
}
/***
* 删除
* */
public String delete() throws Exception {
storageInvoices=storageInvoicesService.getStorageInvoices(storageId);
storageInvoicesService.deleteStorageInvoices(storageInvoices);
return SUCCESS;
}
/**
* 查询
* **/
public String list() throws Exception {
HttpServletRequest request = (HttpServletRequest)ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);//获取request原生对象
NavRequest navRequest = HTMLTableHelper.getNavRequest("storageInvoicesTable", request);
navRequest.setPageSize(20);
try{
whereSql = " and stateId = '00'" ;
dataModel = storageInvoicesService.getUpdateLogDataModel(whereSql, navRequest);
}catch(Exception e){
e.printStackTrace();
}
return SUCCESS;
}
/**库存*/
public String listItemsInformation() throws Exception {
HttpServletRequest request = (HttpServletRequest)ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);//获取request原生对象
NavRequest navRequest = HTMLTableHelper.getNavRequest("storageInvoicesTable", request);
navRequest.setPageSize(20);
try{
whereSql = " and stateId = '01'" ;
dataModel = storageInvoicesService.getUpdateLogDataModel(whereSql, navRequest);
}catch(Exception e){
e.printStackTrace();
}
return SUCCESS;
}
/**出库列表*/
public String listOutWarehouse() throws Exception {
HttpServletRequest request = (HttpServletRequest)ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);//获取request原生对象
NavRequest navRequest = HTMLTableHelper.getNavRequest("storageInvoicesTable", request);
navRequest.setPageSize(20);
try{
whereSql = " and stateId = '02'" ;
dataModel = storageInvoicesService.getUpdateLogDataModel(whereSql, navRequest);
}catch(Exception e){
e.printStackTrace();
}
return SUCCESS;
}
/***
*
* 入库
* */
public String submitStor() throws Exception{
storageInvoices = storageInvoicesService.getStorageInvoices(storageId);
storageInvoices.setStateId(State.getNO_ITEMS().getStateId());
storageInvoicesService.updateStorageInvoices(storageInvoices);
return SUCCESS;
}
/**
* 出库
* **/
public String submitOutW() throws Exception{
storageInvoices = storageInvoicesService.getStorageInvoices(storageId);
storageInvoices.setStateId(State.getNO_OUTW().getStateId());
storageInvoicesService.updateStorageInvoices(storageInvoices);
return SUCCESS;
}
public StorageInvoicesService getStorageInvoicesService() {
return storageInvoicesService;
}
public void setStorageInvoicesService(
StorageInvoicesService storageInvoicesService) {
this.storageInvoicesService = storageInvoicesService;
}
public StorageInvoices getStorageInvoices() {
return storageInvoices;
}
public void setStorageInvoices(StorageInvoices storageInvoices) {
this.storageInvoices = storageInvoices;
}
public List getStorageInvoicesList() {
return storageInvoicesList;
}
public void setStorageInvoicesList(List storageInvoicesList) {
this.storageInvoicesList = storageInvoicesList;
}
public String getStorageId() {
return storageId;
}
public void setStorageId(String storageId) {
this.storageId = storageId;
}
public DataModel getDataModel() {
return dataModel;
}
public void setDataModel(DataModel dataModel) {
this.dataModel = dataModel;
}
public StorageTypeService getStorageTypeService() {
return storageTypeService;
}
public void setStorageTypeService(StorageTypeService storageTypeService) {
this.storageTypeService = storageTypeService;
}
public UnitService getUnitService() {
return unitService;
}
public void setUnitService(UnitService unitService) {
this.unitService = unitService;
}
public String getStorageTypeId() {
return storageTypeId;
}
public void setStorageTypeId(String storageTypeId) {
this.storageTypeId = storageTypeId;
}
public String getUnitId() {
return unitId;
}
public void setUnitId(String unitId) {
this.unitId = unitId;
}
}
页面:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>出库单</title>
<link href="<s:url value="/styles/list.css"/>" rel="stylesheet" type="text/css" />
<link href="<s:url value="/styles/edit.css"/>" rel="stylesheet" type="text/css" />
</head>
<body>
<s:include value="/toolBar.jsp"></s:include>
<div id="formwrapper">
<s:if test="null == storageId">
<div class="current"><h1>出库单</h1></div>
</s:if>
<s:else>
<div class="current"><h1>出库单</h1></div>
</s:else>
<s:form name="storageInvoicesForm" action="saveOutWarehouse" theme="simple" cssStyle="margin:0px;padding:0px;">
<s:action name="listStorageType" id="listStorageType"/>
<s:action name="listUnit" id="listUnit"/>
<s:hidden name="storageInvoices.storageId"/>
<s:hidden name="storageId"/>
<s:hidden name="storageInvoices.stateId"/>
<s:hidden name="storageInvoices.storageType.storageTypeId"/>
<s:hidden name="storageInvoices.unit.unitId"/>
<s:hidden name="motion"/>
<div class="editTable" align="center">
<table width="95%" border="0" cellpadding="0" cellspacing="1" id="viewTableno">
<tr class="trOdd">
<td><s:label value="产品名称:"></s:label>
<s:textfield name="storageInvoices.name" id ="name" size="15" readonly="true"></s:textfield>
</td>
<td>
<s:label value="产品类别:"></s:label>
<s:select list="#listStorageType.storageTypeList" name="storageInvoices.storageType.storageTypeId" value="storageInvoices.storageType.storageTypeId" headerKey="" headerValue="-请选择-" listKey="storageTypeId" listValue="typeName" id="storageId" cssStyle="width:154px;" disabled="true"></s:select>
<input type="hidden" name="storageInvoices.storageType.storageTypeId" value='<s:property value="storageInvoices.storageType.storageTypeId"/>'/>
</td>
</tr>
<tr class="trOdd">
<td>
<s:label value="数量:"></s:label>
<s:textfield name="storageInvoices.amount" id ="amount" readonly="true"></s:textfield>
</td>
<td>
<s:label value="单位:"></s:label>
<s:select list="#listUnit.unitList" name="storageInvoices.unit.unitId" value="storageInvoices.unit.unitId" headerKey="-1" headerValue="-请选择-" listKey="unitId" listValue="name" id="storageId" disabled="true"></s:select>
</td>
</tr>
<tr class="trOdd">
<td align="right">
<s:label value="入库日期:"></s:label>
<s:textfield name="storageInvoices.inputTime" onclick="new WdatePicker(this,'%Y-%M-%D %h:%m',true,'default')" theme="simple" cssStyle="width:150px;" readonly="true"></s:textfield><img src="../images/date.jpg" width="34" height="21" align="absmiddle" style="cursor:pointer;" onclick="new WdatePicker(document.getElementById('inputTime'),'%Y-%M-%D %h:%m',true,'default')" />
</td>
<td>
<s:label value="产品型号:"></s:label>
<s:textfield name="storageInvoices.model" id="model" readonly="true"></s:textfield>
</td>
</tr>
<tr class="trOdd">
<td align="right">
<s:label value="经手人:"></s:label>
<s:textfield name="storageInvoices.dealperson" id="dealperson" readonly="true"></s:textfield>
</td>
</tr>
<tr>
<td >
<s:label value="备注:"></s:label>
</td>
<td colspan="5" align="left"><s:textarea name="storageInvoices.remark" id ="remark" cols="81" rows="5" readonly="true"></s:textarea></td>
</tr>
</table>
</div>
<div class="editTable" align="center">
<table width="95%" border="0" cellpadding="0" cellspacing="1" id="viewTable">
<tr>
<td width="11%" align="right"><s:label value="出库数量:"></s:label></td>
<td width="39%" align="left"><s:textfield size="15" name="storageInvoices.amount3"></s:textfield></td>
</tr>
<tr>
<td >
<s:label value="备注:"></s:label>
</td>
<td colspan="5" align="left"><s:textarea name="storageInvoices.remarks" id ="remarks" cols="81" rows="5"></s:textarea></td>
</tr>
</table>
</div>
<p style="margin: 0px;text-align: center;"><s:submit value="" cssClass="button"></s:submit></p>
</s:form>
</div>
</body>
</html>
初次新增的时候是成功的,当状态变为库存时,填写出库单时,保存就会出现以下错误:
2010-1-10 18:46:31 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
java.lang.IllegalArgumentException: id to load is required for loading
at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:51)
at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:33)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:812)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:470)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:464)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:458)
at com.nxyl.cmpm.warehouse.dao.hibernate.StorageTypeDaoHB.getStorageType(StorageTypeDaoHB.java:34)
at com.nxyl.cmpm.warehouse.service.imp.StorageTypeServiceImp.getStorageType(StorageTypeServiceImp.java:47)
at com.nxyl.cmpm.warehouse.action.StorageInvoicesAction.save(StorageInvoicesAction.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
.....................
请高手大侠们指出错误,在下感谢不尽。。
使用的框架SSH
三个model:
public class StorageInvoices {
private String storageId;
private String name;//产品名称
private StorageType storageType;//产品类别
private int amount;//数量
private Unit unit;//单位
private String inputTime;//入库时间
private String model;//产品型号
private String dealperson;//入库经手人
private String remark;//备注
//库存
private int amount2;//库存数量
// 出库单
private int amount3;//出库数量
private String outperson;//出库经手人
private String remarks;//出库备注
private String stateId; //状态Id
private State state;//状态
public String getStorageId() {
return storageId;
}
public void setStorageId(String storageId) {
this.storageId = storageId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public Unit getUnit() {
return unit;
}
public void setUnit(Unit unit) {
this.unit = unit;
}
public String getInputTime() {
return inputTime;
}
public void setInputTime(String inputTime) {
this.inputTime = inputTime;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getDealperson() {
return dealperson;
}
public void setDealperson(String dealperson) {
this.dealperson = dealperson;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public StorageType getStorageType() {
return storageType;
}
public void setStorageType(StorageType storageType) {
this.storageType = storageType;
}
public String getStateId() {
return stateId;
}
public void setStateId(String stateId) {
this.stateId = stateId;
}
public State getState() {
return state = State.getStateById(stateId);
}
public void setState(State state) {
this.state = state;
}
public int getAmount2() {
return amount2;
}
public void setAmount2(int amount2) {
this.amount2 = amount2;
}
public int getAmount3() {
return amount3;
}
public void setAmount3(int amount3) {
this.amount3 = amount3;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getOutperson() {
return outperson;
}
public void setOutperson(String outperson) {
this.outperson = outperson;
}
}
它的action:
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import net.jcreate.e3.table.DataModel;
import net.jcreate.e3.table.NavRequest;
import net.jcreate.e3.table.html.HTMLTableHelper;
import com.nxyl.cmpm.warehouse.model.State;
import com.nxyl.cmpm.warehouse.model.StorageInvoices;
import com.nxyl.cmpm.warehouse.model.StorageType;
import com.nxyl.cmpm.warehouse.model.Unit;
import com.nxyl.cmpm.warehouse.service.StorageInvoicesService;
import com.nxyl.cmpm.warehouse.service.StorageTypeService;
import com.nxyl.cmpm.warehouse.service.UnitService;
import com.nxyl.common.AbstractAction;
import com.opensymphony.xwork2.ActionContext;
public class StorageInvoicesAction extends AbstractAction {
private StorageInvoicesService storageInvoicesService;
private StorageTypeService storageTypeService;
private UnitService unitService;
private StorageInvoices storageInvoices;
private List storageInvoicesList;
private DataModel dataModel;
private String storageId;
private String storageTypeId;
private String unitId;
private int amount;
private int amount2;
/**
* 编辑
* **/
public String load() throws Exception {
if(storageId==null){
this.setMotion("create");
}else {
this.setMotion("edit");
storageInvoices=storageInvoicesService.getStorageInvoices(storageId);
}
return SUCCESS;
}
/***
* 保存
* */
public String save() throws Exception {
StorageType storageType = storageTypeService.getStorageType(storageTypeId);
storageInvoices.setStorageType(storageType);
Unit unit = unitService.getUnit(unitId);
storageInvoices.setUnit(unit);
if("edit".equalsIgnoreCase(this.getMotion()) && storageId != null){
storageInvoicesService.updateStorageInvoices(storageInvoices);
}else{
storageInvoices.setStateId(State.getNO_STOR().getStateId());
storageInvoicesService.createStorageInvoices(storageInvoices);
}
return SUCCESS;
}
/***
* 删除
* */
public String delete() throws Exception {
storageInvoices=storageInvoicesService.getStorageInvoices(storageId);
storageInvoicesService.deleteStorageInvoices(storageInvoices);
return SUCCESS;
}
/**
* 查询
* **/
public String list() throws Exception {
HttpServletRequest request = (HttpServletRequest)ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);//获取request原生对象
NavRequest navRequest = HTMLTableHelper.getNavRequest("storageInvoicesTable", request);
navRequest.setPageSize(20);
try{
whereSql = " and stateId = '00'" ;
dataModel = storageInvoicesService.getUpdateLogDataModel(whereSql, navRequest);
}catch(Exception e){
e.printStackTrace();
}
return SUCCESS;
}
/**库存*/
public String listItemsInformation() throws Exception {
HttpServletRequest request = (HttpServletRequest)ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);//获取request原生对象
NavRequest navRequest = HTMLTableHelper.getNavRequest("storageInvoicesTable", request);
navRequest.setPageSize(20);
try{
whereSql = " and stateId = '01'" ;
dataModel = storageInvoicesService.getUpdateLogDataModel(whereSql, navRequest);
}catch(Exception e){
e.printStackTrace();
}
return SUCCESS;
}
/**出库列表*/
public String listOutWarehouse() throws Exception {
HttpServletRequest request = (HttpServletRequest)ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);//获取request原生对象
NavRequest navRequest = HTMLTableHelper.getNavRequest("storageInvoicesTable", request);
navRequest.setPageSize(20);
try{
whereSql = " and stateId = '02'" ;
dataModel = storageInvoicesService.getUpdateLogDataModel(whereSql, navRequest);
}catch(Exception e){
e.printStackTrace();
}
return SUCCESS;
}
/***
*
* 入库
* */
public String submitStor() throws Exception{
storageInvoices = storageInvoicesService.getStorageInvoices(storageId);
storageInvoices.setStateId(State.getNO_ITEMS().getStateId());
storageInvoicesService.updateStorageInvoices(storageInvoices);
return SUCCESS;
}
/**
* 出库
* **/
public String submitOutW() throws Exception{
storageInvoices = storageInvoicesService.getStorageInvoices(storageId);
storageInvoices.setStateId(State.getNO_OUTW().getStateId());
storageInvoicesService.updateStorageInvoices(storageInvoices);
return SUCCESS;
}
public StorageInvoicesService getStorageInvoicesService() {
return storageInvoicesService;
}
public void setStorageInvoicesService(
StorageInvoicesService storageInvoicesService) {
this.storageInvoicesService = storageInvoicesService;
}
public StorageInvoices getStorageInvoices() {
return storageInvoices;
}
public void setStorageInvoices(StorageInvoices storageInvoices) {
this.storageInvoices = storageInvoices;
}
public List getStorageInvoicesList() {
return storageInvoicesList;
}
public void setStorageInvoicesList(List storageInvoicesList) {
this.storageInvoicesList = storageInvoicesList;
}
public String getStorageId() {
return storageId;
}
public void setStorageId(String storageId) {
this.storageId = storageId;
}
public DataModel getDataModel() {
return dataModel;
}
public void setDataModel(DataModel dataModel) {
this.dataModel = dataModel;
}
public StorageTypeService getStorageTypeService() {
return storageTypeService;
}
public void setStorageTypeService(StorageTypeService storageTypeService) {
this.storageTypeService = storageTypeService;
}
public UnitService getUnitService() {
return unitService;
}
public void setUnitService(UnitService unitService) {
this.unitService = unitService;
}
public String getStorageTypeId() {
return storageTypeId;
}
public void setStorageTypeId(String storageTypeId) {
this.storageTypeId = storageTypeId;
}
public String getUnitId() {
return unitId;
}
public void setUnitId(String unitId) {
this.unitId = unitId;
}
}
页面:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>出库单</title>
<link href="<s:url value="/styles/list.css"/>" rel="stylesheet" type="text/css" />
<link href="<s:url value="/styles/edit.css"/>" rel="stylesheet" type="text/css" />
</head>
<body>
<s:include value="/toolBar.jsp"></s:include>
<div id="formwrapper">
<s:if test="null == storageId">
<div class="current"><h1>出库单</h1></div>
</s:if>
<s:else>
<div class="current"><h1>出库单</h1></div>
</s:else>
<s:form name="storageInvoicesForm" action="saveOutWarehouse" theme="simple" cssStyle="margin:0px;padding:0px;">
<s:action name="listStorageType" id="listStorageType"/>
<s:action name="listUnit" id="listUnit"/>
<s:hidden name="storageInvoices.storageId"/>
<s:hidden name="storageId"/>
<s:hidden name="storageInvoices.stateId"/>
<s:hidden name="storageInvoices.storageType.storageTypeId"/>
<s:hidden name="storageInvoices.unit.unitId"/>
<s:hidden name="motion"/>
<div class="editTable" align="center">
<table width="95%" border="0" cellpadding="0" cellspacing="1" id="viewTableno">
<tr class="trOdd">
<td><s:label value="产品名称:"></s:label>
<s:textfield name="storageInvoices.name" id ="name" size="15" readonly="true"></s:textfield>
</td>
<td>
<s:label value="产品类别:"></s:label>
<s:select list="#listStorageType.storageTypeList" name="storageInvoices.storageType.storageTypeId" value="storageInvoices.storageType.storageTypeId" headerKey="" headerValue="-请选择-" listKey="storageTypeId" listValue="typeName" id="storageId" cssStyle="width:154px;" disabled="true"></s:select>
<input type="hidden" name="storageInvoices.storageType.storageTypeId" value='<s:property value="storageInvoices.storageType.storageTypeId"/>'/>
</td>
</tr>
<tr class="trOdd">
<td>
<s:label value="数量:"></s:label>
<s:textfield name="storageInvoices.amount" id ="amount" readonly="true"></s:textfield>
</td>
<td>
<s:label value="单位:"></s:label>
<s:select list="#listUnit.unitList" name="storageInvoices.unit.unitId" value="storageInvoices.unit.unitId" headerKey="-1" headerValue="-请选择-" listKey="unitId" listValue="name" id="storageId" disabled="true"></s:select>
</td>
</tr>
<tr class="trOdd">
<td align="right">
<s:label value="入库日期:"></s:label>
<s:textfield name="storageInvoices.inputTime" onclick="new WdatePicker(this,'%Y-%M-%D %h:%m',true,'default')" theme="simple" cssStyle="width:150px;" readonly="true"></s:textfield><img src="../images/date.jpg" width="34" height="21" align="absmiddle" style="cursor:pointer;" onclick="new WdatePicker(document.getElementById('inputTime'),'%Y-%M-%D %h:%m',true,'default')" />
</td>
<td>
<s:label value="产品型号:"></s:label>
<s:textfield name="storageInvoices.model" id="model" readonly="true"></s:textfield>
</td>
</tr>
<tr class="trOdd">
<td align="right">
<s:label value="经手人:"></s:label>
<s:textfield name="storageInvoices.dealperson" id="dealperson" readonly="true"></s:textfield>
</td>
</tr>
<tr>
<td >
<s:label value="备注:"></s:label>
</td>
<td colspan="5" align="left"><s:textarea name="storageInvoices.remark" id ="remark" cols="81" rows="5" readonly="true"></s:textarea></td>
</tr>
</table>
</div>
<div class="editTable" align="center">
<table width="95%" border="0" cellpadding="0" cellspacing="1" id="viewTable">
<tr>
<td width="11%" align="right"><s:label value="出库数量:"></s:label></td>
<td width="39%" align="left"><s:textfield size="15" name="storageInvoices.amount3"></s:textfield></td>
</tr>
<tr>
<td >
<s:label value="备注:"></s:label>
</td>
<td colspan="5" align="left"><s:textarea name="storageInvoices.remarks" id ="remarks" cols="81" rows="5"></s:textarea></td>
</tr>
</table>
</div>
<p style="margin: 0px;text-align: center;"><s:submit value="" cssClass="button"></s:submit></p>
</s:form>
</div>
</body>
</html>
初次新增的时候是成功的,当状态变为库存时,填写出库单时,保存就会出现以下错误:
2010-1-10 18:46:31 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
java.lang.IllegalArgumentException: id to load is required for loading
at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:51)
at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:33)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:812)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:470)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:464)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:458)
at com.nxyl.cmpm.warehouse.dao.hibernate.StorageTypeDaoHB.getStorageType(StorageTypeDaoHB.java:34)
at com.nxyl.cmpm.warehouse.service.imp.StorageTypeServiceImp.getStorageType(StorageTypeServiceImp.java:47)
at com.nxyl.cmpm.warehouse.action.StorageInvoicesAction.save(StorageInvoicesAction.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
.....................
请高手大侠们指出错误,在下感谢不尽。。
相关文章推荐
- 今天在家装Tomcat服务器,郁闷了,遇到一个问题装好开启服务后 进入不了manager/
- 今天遇到的一个郁闷的问题。
- 周末发现一个BUG,时有时无,一出程序就崩溃,郁闷了好久,终于跟出来来了,记之,提醒自己今后一定规范编写,只要规范,绝对不会出问题
- 一个让我郁闷两个小时的问题
- 【20100121】今天firefox碰到了一个郁闷的问题
- 又碰到一个郁闷的问题
- 请教各位C/VC高手一个极其郁闷的问题
- ASP.NET AJAX 一个超级郁闷的问题
- 一个令人郁闷的Ajax问题(about AjaxPro)
- 几次面试都遇到同一个问题,真是郁闷,长时间不写正则快忘了
- js中的一个超郁闷问题(有关字符串的length比较问题)
- vs2005 不能新建asp.net(一个极郁闷的问题+极郁闷的解决方案)
- ListBox的一个郁闷小问题!
- 碰到一个郁闷的问题
- 终于结束了一个郁闷+棘手的问题,但是却迎来了新的问题!!!!超级郁闷~~~~~
- 一个比较郁闷的问题
- 一个博客的排版问题,郁闷中
- 今天解决了一个很郁闷的问题!
- 一个VS中项目显示当前目录所有文件的解决办法,曾经让我郁闷的问题~
- 发现JBuilder8的一个问题,郁闷了两个晚上!