(25号要交毕业设计初稿了,请各位大侠帮帮忙,急需解决)
我用ssh做了个项目,页面使用struts标签。
在三表联查部分,以前是好的,现在页面显示上出了问题,代码应该是正确的,有五个地方用到了多表联查,现在只有一个两表联查可以显示。
比如说 显示订单页面, 订单有 customerid 我在页面显示的是 customer.name 出错了 下面我把详细信息贴出来dao部分
try{
List items = this.getSession().createQuery("from Item where item_state=0").list();
System.out.println(items+"items");
return items;
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return null;
}finally {
this.getSession().close();
}
action部分
List items=this.getItemService().manageritem();
if(items!=null){
request.setAttribute("items", items);
return new ActionForward("/bg-manageritem.jsp");
}else
return mapping.findForward("");
页面显示部分<logic:empty name="items">
<tr>
<td colspan="7">暂时没有订单</td>
</tr>
</logic:empty>
<logic:notEmpty name="items">
<logic:iterate id="i" name="items">
<tr>
<td> <bean:write name="i" property="id"/></td>
<td> <bean:write name="i" property="facility.name"/></td>
<td> <bean:write name="i" property="customer.name"/> </td>
<td> <bean:write name="i" property="hiretime" format="yyyy-MM-dd"/></td>
<td> <bean:write name="i" property="returntime" format="yyyy-MM-dd"/></td>
<td> <bean:write name="i" property="hireprice"/></td>
<td> <bean:write name="i" property="num"/></td>
我用ssh做了个项目,页面使用struts标签。
在三表联查部分,以前是好的,现在页面显示上出了问题,代码应该是正确的,有五个地方用到了多表联查,现在只有一个两表联查可以显示。
比如说 显示订单页面, 订单有 customerid 我在页面显示的是 customer.name 出错了 下面我把详细信息贴出来dao部分
try{
List items = this.getSession().createQuery("from Item where item_state=0").list();
System.out.println(items+"items");
return items;
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return null;
}finally {
this.getSession().close();
}
action部分
List items=this.getItemService().manageritem();
if(items!=null){
request.setAttribute("items", items);
return new ActionForward("/bg-manageritem.jsp");
}else
return mapping.findForward("");
页面显示部分<logic:empty name="items">
<tr>
<td colspan="7">暂时没有订单</td>
</tr>
</logic:empty>
<logic:notEmpty name="items">
<logic:iterate id="i" name="items">
<tr>
<td> <bean:write name="i" property="id"/></td>
<td> <bean:write name="i" property="facility.name"/></td>
<td> <bean:write name="i" property="customer.name"/> </td>
<td> <bean:write name="i" property="hiretime" format="yyyy-MM-dd"/></td>
<td> <bean:write name="i" property="returntime" format="yyyy-MM-dd"/></td>
<td> <bean:write name="i" property="hireprice"/></td>
<td> <bean:write name="i" property="num"/></td>
[pojo.Item@e8c7db, pojo.Item@992fa5, pojo.Item@10718b7, pojo.Item@e7ce4c, pojo.Item@99176f, pojo.Item@d1ad08, pojo.Item@1b70f9e, pojo.Item@1627c16, pojo.Item@c0890f, pojo.Item@666d83, pojo.Item@9fd062, pojo.Item@29f93b, pojo.Item@1a998c7, pojo.Item@16d4b50, pojo.Item@6b93c5, pojo.Item@b28980, pojo.Item@161509b, pojo.Item@1f30035, pojo.Item@92af24, pojo.Item@287b58, pojo.Item@1b9f88b, pojo.Item@6c9ec6, pojo.Item@12beeec, pojo.Item@152e961, pojo.Item@57f57f, pojo.Item@b68e0e, pojo.Item@128594c, pojo.Item@1feaf06, pojo.Item@194ba17, pojo.Item@14562c5, pojo.Item@577c5e]items
Hibernate: select facility0_.id as id2_0_, facility0_.name as name2_0_, facility0_.price as price2_0_, facility0_.type as type2_0_, facility0_.workshop as workshop2_0_, facility0_.descrip as descrip2_0_, facility0_.indate as indate2_0_, facility0_.num as num2_0_, facility0_.icon as icon2_0_ from test.facility facility0_ where facility0_.id=?
Hibernate: select customer0_.id as id0_0_, customer0_.name as name0_0_, customer0_.password as password0_0_, customer0_.email as email0_0_, customer0_.address as address0_0_, customer0_.tel as tel0_0_, customer0_.idcard as idcard0_0_ from test.customer customer0_ where customer0_.id=?
Hibernate: select facility0_.id as id2_0_, facility0_.name as name2_0_, facility0_.price as price2_0_, facility0_.type as type2_0_, facility0_.workshop as workshop2_0_, facility0_.descrip as descrip2_0_, facility0_.indate as indate2_0_, facility0_.num as num2_0_, facility0_.icon as icon2_0_ from test.facility facility0_ where facility0_.id=?
2009-5-23 16:00:10 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Exception thrown by getter for property: "facility.name" of bean: "i"
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:969)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:225)
at org.apache.jsp.bg_002dmanageritem_jsp._jspx_meth_bean_005fwrite_005f1(bg_002dmanageritem_jsp.java:277)
at org.apache.jsp.bg_002dmanageritem_jsp._jspService(bg_002dmanageritem_jsp.java:145)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at filter.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
2009-5-23 16:00:10 org.apache.catalina.core.StandardWrapperValve invoke
页面报错
org.apache.jasper.JasperException: An exception occurred processing JSP page /bg-manageritem.jsp at line 3936: <logic:iterate id="i" name="items">
37: <tr>
38: <td> <bean:write name="i" property="id"/></td>
39: <td> <bean:write name="i" property="facility.name"/></td>
40: <td> <bean:write name="i" property="customer.name"/> </td>
41: <td> <bean:write name="i" property="hiretime" format="yyyy-MM-dd"/></td>
42: <td> <bean:write name="i" property="returntime" format="yyyy-MM-dd"/></td>
Hibernate: select item0_.id as id3_, item0_.hiretime as hiretime3_, item0_.returntime as returntime3_, item0_.hireprice as hireprice3_, item0_.item_state as item5_3_, item0_.num as num3_, item0_.customer_id as customer7_3_, item0_.facility_id as facility8_3_ from test.item item0_ where item0_.item_state=0
[pojo.Item@e8c7db, pojo.Item@992fa5, pojo.Item@10718b7, pojo.Item@e7ce4c, pojo.Item@99176f, pojo.Item@d1ad08, pojo.Item@1b70f9e, pojo.Item@1627c16, pojo.Item@c0890f, pojo.Item@666d83, pojo.Item@9fd062, pojo.Item@29f93b, pojo.Item@1a998c7, pojo.Item@16d4b50, pojo.Item@6b93c5, pojo.Item@b28980, pojo.Item@161509b, pojo.Item@1f30035, pojo.Item@92af24, pojo.Item@287b58, pojo.Item@1b9f88b, pojo.Item@6c9ec6, pojo.Item@12beeec, pojo.Item@152e961, pojo.Item@57f57f, pojo.Item@b68e0e, pojo.Item@128594c, pojo.Item@1feaf06, pojo.Item@194ba17, pojo.Item@14562c5, pojo.Item@577c5e]items
Hibernate: select facility0_.id as id2_0_, facility0_.name as name2_0_, facility0_.price as price2_0_, facility0_.type as type2_0_, facility0_.workshop as workshop2_0_, facility0_.descrip as descrip2_0_, facility0_.indate as indate2_0_, facility0_.num as num2_0_, facility0_.icon as icon2_0_ from test.facility facility0_ where facility0_.id=?
Hibernate: select customer0_.id as id0_0_, customer0_.name as name0_0_, customer0_.password as password0_0_, customer0_.email as email0_0_, customer0_.address as address0_0_, customer0_.tel as tel0_0_, customer0_.idcard as idcard0_0_ from test.customer customer0_ where customer0_.id=?
Hibernate: select facility0_.id as id2_0_, facility0_.name as name2_0_, facility0_.price as price2_0_, facility0_.type as type2_0_, facility0_.workshop as workshop2_0_, facility0_.descrip as descrip2_0_, facility0_.indate as indate2_0_, facility0_.num as num2_0_, facility0_.icon as icon2_0_ from test.facility facility0_ where facility0_.id=?
2009-5-23 16:00:10 org.apache.catalina.core.ApplicationDispatcher invokehibernate 都输出查询语句了 查询结果页出来了[pojo.Item@e8c7db, pojo.Item@992fa5, pojo.Item@10718b7, pojo.Item@e7ce4c, pojo.Item@99176f, pojo.Item@d1ad08, pojo.Item@1b70f9e, pojo.Item@1627c16, pojo.Item@c0890f, pojo.Item@666d83, pojo.Item@9fd062, pojo.Item@29f93b, pojo.Item@1a998c7, pojo.Item@16d4b50, pojo.Item@6b93c5, pojo.Item@b28980, pojo.Item@161509b, pojo.Item@1f30035, pojo.Item@92af24, pojo.Item@287b58, pojo.Item@1b9f88b, pojo.Item@6c9ec6, pojo.Item@12beeec, pojo.Item@152e961, pojo.Item@57f57f, pojo.Item@b68e0e, pojo.Item@128594c, pojo.Item@1feaf06, pojo.Item@194ba17, pojo.Item@14562c5, pojo.Item@577c5e]items就是页面显示错误
Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Exception thrown by getter for property: "facility.name" of bean: "i"
看看 bean 的属性,,,这是很明显的