title: Property not found exception in JSP EL
body: <p>Very annoying. Don't know why this error is coming. In the below code</p>
  
  <pre><code>NOTE:
  
  if I only use &lt;td&gt;${user.id}&lt;/td&gt; than its printing id properly but on ${user.username} property generating error. See below JSP page code.
  
  If I use below code in JSP page like to test than I get all the objects and properties
  
  
  &lt;c:forEach var="user" items="${users}" varStatus="i"&gt;
      &lt;tr&gt;
          &lt;td&gt;${users[i.index]}&lt;/td&gt;
      &lt;/tr&gt;                       
  &lt;/c:forEach&gt;
  
  Result:
  
  User[id=1,username=u1,password=p1,firstname=f1,lastname=l1,dob=2012-07-01,age=40]
  User[id=2,username=u2,password=p2,firstname=f2,lastname=l2,dob=2012-07-02,age=39]
  User[id=3,username=u3,password=p3,firstname=f3,lastname=l3,dob=2012-07-03,age=38]
  </code></pre>
  
  <p><strong>ERROR:</strong></p>
  
  <pre><code>09:49:49,047 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/crud_jsp_servlet_cdi_jdbc_tagfile].[jsp]] (http-localhost-127.0.0.1-8080-1) Servlet.service() for servlet jsp threw exception: javax.el.PropertyNotFoundException: The class 'com.myapp.dao.User' does not have the property 'username'.
      at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:661) [jboss-el-api_2.2_spec-1.0.0.Final.jar:1.0.0.Final]
      at javax.el.BeanELResolver.getValue(BeanELResolver.java:290) [jboss-el-api_2.2_spec-1.0.0.Final.jar:1.0.0.Final]
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175) [jboss-el-api_2.2_spec-1.0.0.Final.jar:1.0.0.Final]
      at org.apache.el.parser.AstValue.getValue(AstValue.java:169) [jbossweb-7.0.13.Final.jar:]
      at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.0.13.Final.jar:]
      at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:935) [jbossweb-7.0.13.Final.jar:]
      at org.apache.jsp.WEB_002dINF.admin.UserList_jsp._jspx_meth_c_005fforEach_005f0(UserList_jsp.java:137)
      at org.apache.jsp.WEB_002dINF.admin.UserList_jsp.access$1(UserList_jsp.java:114)
      at org.apache.jsp.WEB_002dINF.admin.UserList_jsp$Helper.invoke1(UserList_jsp.java:215)
      at org.apache.jsp.WEB_002dINF.admin.UserList_jsp$Helper.invoke(UserList_jsp.java:240)
      at org.apache.jsp.tag.web.layout_tag.doTag(layout_tag.java:120)
      at org.apache.jsp.WEB_002dINF.admin.UserList_jsp._jspx_meth_tags_005flayout_005f0(UserList_jsp.java:96)
      at org.apache.jsp.WEB_002dINF.admin.UserList_jsp._jspService(UserList_jsp.java:69)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
  </code></pre>
  
  <p><em><strong>JSP Page:</em></strong></p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
  &lt;%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%&gt;
  
  &lt;tags:layout path="${pageContext.request.contextPath}"&gt;
      &lt;jsp:attribute name="search"&gt;
          &lt;tags:search /&gt;
      &lt;/jsp:attribute&gt;
      &lt;jsp:body&gt;
          &lt;div class="mainDiv"&gt;
              &lt;table class="table table-striped table-bordered table-condensed"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;Id&lt;/th&gt;
                          &lt;th&gt;UserName&lt;/th&gt;
                          &lt;th&gt;Password&lt;/th&gt;
                          &lt;th&gt;FirstName&lt;/th&gt;
                          &lt;th&gt;LastName&lt;/th&gt;
                          &lt;th&gt;Date of Birth&lt;/th&gt;
                          &lt;th&gt;Age&lt;/th&gt;
                          &lt;th&gt;Actions&lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                      &lt;c:forEach var="user" items="${users}"&gt;
                          &lt;tr&gt;
                              &lt;td&gt;${user.id}&lt;/td&gt;
                              &lt;td&gt;${user.username}&lt;/td&gt;
                              &lt;td&gt;${user.password}&lt;/td&gt;
                              &lt;td&gt;${user.firstname}&lt;/td&gt;
                              &lt;td&gt;${user.lastname}&lt;/td&gt;
                              &lt;td&gt;${user.dob}&lt;/td&gt;
                              &lt;td&gt;${user.age}&lt;/td&gt;
                              &lt;td&gt;&lt;a href="#"&gt;&lt;i class="icon-edit"&gt;&lt;/i&gt;&lt;/a&gt; &lt;a href="#"&gt;&lt;i
                                      class="icon-trash"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/c:forEach&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/jsp:body&gt;
  &lt;/tags:layout&gt;
  </code></pre>
  
  <p><em><strong>User.java</em></strong></p>
  
  <pre><code>package com.myapp.dao;
  
  import java.sql.Date;
  
  
  public class User {
  
      private Long id;
      private String username;
      private String password;
      private String firstname;
      private String lastname;
      private Date dob;
      private int age;
  
      public User(){
      };
  
      public User(Long id, String username, String password, String firstname, String lastname, Date dob, int age){
  
          this.id = id;
          this.username = username;
          this.password = password;
          this.firstname = firstname;
          this.lastname = lastname;
          this.dob = dob;
          this.age = age;
      }
  
      public Long getId(){
          return id;
      }
  
      public void setId(Long id){
          this.id = id;
      }
  
      public String getUserName(){
          return username;
      }
  
      public void setUserName(String username){
          this.username = username;
      }
  
      public String getPassword(){
          return password;
      }
  
      public void setPassword(String password){
          this.password = password;
      }
  
      public String getFirstName(){
          return firstname;
      }
  
      public void setFirstName(String firstname){
          this.firstname = firstname;
      }
  
      public String getLastName(){
          return lastname;
      }
  
      public void setLastName(String lastname){
          this.lastname = lastname;
      }
  
      public Date getDob(){
          return dob;
      }
  
      public void setDob(Date dob){
          this.dob = dob;
      }
  
      public int getAge(){
          return age;
      }
  
      public void setAge(int age){
          this.age = age;
      }
  
      public String getFullName(){
          return this.firstname + " " + this.lastname;
      }
  
  }
  </code></pre>
  
  <p><em><strong>Selvlet:</em></strong></p>
  
  <pre><code>List&lt;User&gt; users = null;
          userDAO = new UserDAOJDBC();
  
          users = userDAO.listUsers();
          request.setAttribute("users", users);
  
          String path = "/WEB-INF/admin/UserList.jsp";
          getServletContext().getRequestDispatcher(path).forward(request, response);
  </code></pre>