为了账号安全,请及时绑定邮箱和手机立即绑定

javax.el.PropertyNotFoundException:com.example.Bea

javax.el.PropertyNotFoundException:com.example.Bea

喵喵时光机 2019-06-18 13:15:39
javax.el.PropertyNotFoundException:com.example.Bea我有结果Query query = session.createQuery("From Pool as p left join fetch p.poolQuestion as s");查询和我想在JSP上显示它。我有循环:<c:forEach items="${pools}" var="pool">      <p>${pool.name}</p></c:forEach>我想显示池问题表(即联接表)的结果。我想显示的值是“答案”。我该怎么做?<c:forEach items="${pools}" var="pool">      <p>${pool.answer}</p>     <p>${pool.name}</p>             </c:forEach>上面的代码不起作用。错误是:  org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/views/home.jsp at line 2118:        <c:forEach items="${pools}" var="pool"> 19:             20:                 <p>${pool.name}</p>21:             <c:out value="${pool.poolQuestion.answer}"/>22:                   23:     </c:forEach>24:      SEVERE: Servlet.service() for servlet appServlet threw exception javax.el.PropertyNotFoundException: Property 'answer' not found on type com.pool.app.domain.Pool     at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:214)     at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:191)     at javax.el.BeanELResolver.property(BeanELResolver.java:300)     at javax.el.BeanELResolver.getValue(BeanELResolver.java:81)     at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)     at org.apache.el.parser.AstValue.getValue(AstValue.java:123)     at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)     at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:938)     at org.apache.jsp.WEB_002dINF.views.home_jsp._jspx_meth_c_005fforEach_005f0(home_jsp.java:119)模式是:public List<Pool> getAll(){     Session session = sessionFactory.getCurrentSession();     Query query = session.createQuery("From Pool as p left join fetch p.poolQuestions as s");     return query.list();主计长是:List<Pool> pool = poolService.getAll();model.addAttribute("pools", pool);其观点是:<c:forEach items="${pools}" var="pool">      <p>${pool.name}</p>     <c:out value="${pool.answer}"/></c:forEach>PS。这个${pool.name}正确显示
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 448 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信