title: javax.el.PropertyNotFoundException: Property 'tname' not found on type java.lang.String
body: <p>I was using scriptlets earlier, but now I switched to the mvc. I am not able to retrieve values on to the JSP page and getting errors:</p>
  
  <pre><code>javax.el.PropertyNotFoundException: Property 'tname' not found on type java.lang.String
  </code></pre>
  
  <p>Code of the Bean:</p>
  
  <pre><code>public class regForm extends org.apache.struts.validator.ValidatorForm implements Iprafunctions {
  
      private String tname = null;
      private String tfee = null;
  
      public String getTfee() {
          return tfee;
      }
  
      public void setTfee(String tfee) {
          this.tfee = tfee;
      }
  
      public String getTname() {
          return tname;
      }
  
      public void setTname(String tname) {
          this.tname = tname;
      }
      public regForm() {
          super();
      }
  }
  </code></pre>
  
  <p>Action controller:</p>
  
  <pre><code>public ActionForward mvc(ActionMapping mapping, ActionForm form,
          HttpServletRequest request, HttpServletResponse response)
          throws Exception {
      regForm reg = (regForm) form;
      String sql = "Select tname,tfee from addtest order by tname";
      ResultSet rs = SQLC.getData(sql, null);
      Collection myBeans = new ArrayList();
      while (rs.next()) {
          String testname = rs.getString("tname");
          String testfee = rs.getString("tfee");
          reg.setTname(testname);
          reg.setTfee(testfee);
          myBeans.add(reg.getTname());
          myBeans.add(reg.getTfee());
      }
      request.setAttribute("myBeans", myBeans);
      return mapping.findForward(SUCCESS);
  }
  </code></pre>
  
  <p>Access in JSP Page</p>
  
  <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;table&gt;
      &lt;tr&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;Fee&lt;/td&gt;&lt;/tr&gt;
      &lt;c:forEach var="reg" items="${myBeans}"&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;c:out value="${reg.tname}"&gt;&lt;/c:out&gt;&lt;/td&gt;
              &lt;td&gt;&lt;c:out value="${reg.tfee}"&gt;&lt;/c:out&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/c:forEach&gt;
  &lt;/table&gt;
  </code></pre>