title: javax.el.PropertyNotFoundException: Property 'foo' not found on type com.example.Bean
body: <p>I have results from</p>
  
  <pre><code>Query query = session.createQuery("From Pool as p left join fetch p.poolQuestion as s");
  </code></pre>
  
  <p>query and I would like to display it on JSP.</p>
  
  <p>I have loop:</p>
  
  <pre><code>&lt;c:forEach items="${pools}" var="pool"&gt; 
  
      &lt;p&gt;${pool.name}&lt;/p&gt;
  
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>and I would like to display results from poolQuestion table (which is Join table). The value that i want to display is 'answer'.</p>
  
  <p>How can I do it?</p>
  
  <pre><code>&lt;c:forEach items="${pools}" var="pool"&gt; 
      &lt;p&gt;${pool.answer}&lt;/p&gt;
      &lt;p&gt;${pool.name}&lt;/p&gt;             
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>The above code doesn't works.</p>
  
  <p>The error is:</p>
  
  <pre><code>  org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/views/home.jsp at line 21
  
  18:     &lt;c:forEach items="${pools}" var="pool"&gt; 
  19:             
  20:             &lt;p&gt;${pool.name}&lt;/p&gt;
  21:             &lt;c:out value="${pool.poolQuestion.answer}"/&gt;
  22:             
  23:     &lt;/c:forEach&gt;
  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)
      at org.apache.jsp.WEB_002dINF.views.home_jsp._jspService(home_jsp.java:78)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      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:646)
      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.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      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:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      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:291)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:680)
  </code></pre>
  
  <p>The model is:</p>
  
  <pre><code>public List&lt;Pool&gt; getAll(){
  
      Session session = sessionFactory.getCurrentSession();
  
      Query query = session.createQuery("From Pool as p left join fetch p.poolQuestions as s");
  
      return query.list();
  </code></pre>
  
  <p>The controller is:</p>
  
  <pre><code>List&lt;Pool&gt; pool = poolService.getAll();
  
  model.addAttribute("pools", pool);
  </code></pre>
  
  <p>And the View is:</p>
  
  <pre><code>&lt;c:forEach items="${pools}" var="pool"&gt; 
  
      &lt;p&gt;${pool.name}&lt;/p&gt;
      &lt;c:out value="${pool.answer}"/&gt;
  
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>PS. the <code>${pool.name}</code> is displayed properly</p>