title: jsf giving method not found Exception though it is there, javax.el.MethodNotFoundException
body: <p>I m getting the following exception when trying to display a <code>h:dataTable</code> using the backing bean</p>
  
  <pre><code>javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: /table.xhtml @29,36 action="#{user.editEmployee}": Method not found: com.jason.jsf.User@1df228e.editEmployee()
  javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
  com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
  javax.faces.component.UICommand.broadcast(UICommand.java:311)
  javax.faces.component.UIData.broadcast(UIData.java:912)
  javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
  javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
  com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
  com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
  com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
  javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  </code></pre>
  
  <p>When executing the following code with these files as i am new to jsf and i m learning please help with some explanation</p>
  
  <p>Employee.java</p>
  
  <pre><code> package com.jason.jsf;
  
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  
  @ManagedBean(name = "employee", eager = true)
  @SessionScoped
  public class Employee {
  
      private String Id, name;
      private boolean canEdit;
  
      public Employee() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      public Employee(String id, String name) {
          super();
          Id = id;
          this.name = name;
      }
  
      public String getId() {
          return Id;
      }
  
      public void setId(String id) {
          Id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public boolean isCanEdit() {
          return canEdit;
      }
  
      public void setCanEdit(boolean canEdit) {
          this.canEdit = canEdit;
      }
  
  }
  </code></pre>
  
  <p>Here is my User.java</p>
  
  <pre><code>    package com.jason.jsf;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  
  @ManagedBean(name = "user", eager = true)
  @SessionScoped
  public class User {
  
      private static final long serialVersionUID = 1L;
  
      private String name;
      private String id;
  
      private static final ArrayList&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;(
              Arrays.asList(new Employee("John", "Marketing"), new Employee(
                      "Robert", "Marketing"), new Employee("Mark", "Sales"),
                      new Employee("Chris", "Marketing"), new Employee("Peter",
                              "Customer Care")));
  
  
  
  
      public ArrayList&lt;Employee&gt; getEmployees() {
          return employees;
      }
  
       public String addEmployee() {
       Employee employee = new Employee(name, id);
       employees.add(employee);
       return null;
       }
  
       public String deleteEmployee(Employee employee) {
       employees.remove(employee);
       return null;
       }
  
        public String editEmployee(Employee employee){
            employee.setCanEdit(true);
            return null;
         }
  
         public String saveEmployees(){
            //set "canEdit" of all employees to false 
            for (Employee employee : employees){
               employee.setCanEdit(false);
            }     
            return null;
         }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      /**
       * @return the id
       */
      public String getId() {
          return id;
      }
  
      /**
       * @param id
       *            the id to set
       */
      public void setId(String id) {
          this.id = id;
      }
  
  }
  </code></pre>
  
  <p>Here is my table.xhtml </p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"&gt;
  &lt;h:head&gt;
      &lt;title&gt;JSF tutorial&lt;/title&gt;
      &lt;h:outputStylesheet library="css" name="style.css" /&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h:form&gt;
          &lt;h:dataTable value="#{user.employees}" var="emp"
              styleClass="employeeTable" headerClass="employeeTableHeader"
              rowClasses="employeeTableOddRow,employeeTableEvenRow"&gt;
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;Name&lt;/f:facet&gt;
                  &lt;h:inputText value="#{emp.name}" size="10" rendered="#{emp.canEdit}" /&gt;
                  &lt;h:outputText value="#{emp.name}" rendered="#{not emp.canEdit}" /&gt;
              &lt;/h:column&gt;
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;ID&lt;/f:facet&gt;
                  &lt;h:inputText value="#{emp.id}" size="20" rendered="#{emp.canEdit}" /&gt;
                  &lt;h:outputText value="#{emp.id}" rendered="#{not emp.canEdit}" /&gt;
              &lt;/h:column&gt;
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;Edit&lt;/f:facet&gt;
                  &lt;h:commandButton value="Edit" action="#{user.editEmployee}"
                      rendered="#{not emp.canEdit}"&gt;
                  &lt;/h:commandButton&gt;
              &lt;/h:column&gt;
          &lt;/h:dataTable&gt;
          &lt;br /&gt;
          &lt;h:commandButton value="Save Employees" action="#{user.saveEmployees}" /&gt;
  
      &lt;/h:form&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I have referred different similar questions but didn't get an answer appropriate to my problem. Please help me with the solution </p>
  
  <p>Thanks in advance.</p>