错误代码有点多,本人先将主要的错误代码发上来,请高手帮忙答疑解惑!
2016-1-28 16:43:02 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.esprit.espbusi.model.StockItem#com.esprit.espbusi.model.StockItem@5a1706cc]
2016-01-28 16:43:02,348 ERROR taglib.tiles.InsertTag -> ServletException in “”/WEB-INF/jsp/ordr/listDetail.jsp””: Error reading “”division”” on type com.esprit.espbusi.model.StockItem$$EnhancerByCGLIB$$8163802c
org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsp/ordr/listDetail.jsp at line 156
153: <td><fmt:formatDate value=”${x_object.ordr.date}” pattern=”yyyy-MM-dd HH:mm:ss”/></td>
154:
155: <td>${x_object.item.id}</td>
156: <td>${x_object.item.division}</td>
157: <td>${x_object.item.line}</td>
158: <td>${x_object.item.year}</td>
159: <td>${x_object.item.sea}</td>
2016-1-28 16:43:02 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: ServletException in “”/WEB-INF/jsp/ordr/listDetail.jsp””: Error reading “”division”” on type com.esprit.espbusi.model.StockItem$$EnhancerByCGLIB$$8163802c
2016-1-28 16:43:02 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: ServletException in “”/WEB-INF/jsp/ordr/listDetail.jsp””: Error reading “”division”” on type com.esprit.espbusi.model.StockItem$$EnhancerByCGLIB$$8163802c
2016-1-28 16:43:02 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.esprit.espbusi.model.StockItem#com.esprit.espbusi.model.StockItem@5a1706cc]
2016-01-28 16:43:02,348 ERROR taglib.tiles.InsertTag -> ServletException in “”/WEB-INF/jsp/ordr/listDetail.jsp””: Error reading “”division”” on type com.esprit.espbusi.model.StockItem$$EnhancerByCGLIB$$8163802c
org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsp/ordr/listDetail.jsp at line 156
153: <td><fmt:formatDate value=”${x_object.ordr.date}” pattern=”yyyy-MM-dd HH:mm:ss”/></td>
154:
155: <td>${x_object.item.id}</td>
156: <td>${x_object.item.division}</td>
157: <td>${x_object.item.line}</td>
158: <td>${x_object.item.year}</td>
159: <td>${x_object.item.sea}</td>
2016-1-28 16:43:02 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: ServletException in “”/WEB-INF/jsp/ordr/listDetail.jsp””: Error reading “”division”” on type com.esprit.espbusi.model.StockItem$$EnhancerByCGLIB$$8163802c
2016-1-28 16:43:02 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: ServletException in “”/WEB-INF/jsp/ordr/listDetail.jsp””: Error reading “”division”” on type com.esprit.espbusi.model.StockItem$$EnhancerByCGLIB$$8163802c
解决方案:50分
看了下,你这使用的是懒加载,所以在jsp页面打印的时候,才会发送真实的查询请求到数据库,而这时候,查询的结果为空,所以报上面的异常。因此,你在程序代码里查询完这个对象后,判断下能否为空,为空就走其他流程了。