title: change the datatable outputText to inputText when clicked on Edit Button
body: <p>I m trying to display data in jsf datable data from the database,ans in a same row i m displaying link for Edit. Now when user will clicked on edit button then it should be inputText from outputText. Here i have done coding for that but i can't change the textbox can u please help me? Thanks in advance.</p>
  
  <p>ShowData.xhtml</p>
  
  <pre><code>&lt;h:dataTable value="#{customerdata.customerList}" var="c" 
              styleClass="order-table" binding="#{customerdata.dataTable}"
              headerClass="order-table-header" border="1" width="100%"
              rowClasses="order-table-odd-row,order-table-even-row" rows="3"&gt;
  
          &lt;h:column&gt;
              &lt;h:selectBooleanCheckbox&gt;&lt;/h:selectBooleanCheckbox&gt;
          &lt;/h:column&gt;
          &lt;h:column&gt;
          &lt;f:facet name="heder"&gt;User ID&lt;/f:facet&gt;
              &lt;h:inputText value="#{c.cust_id}" size="10" rendered="#{c.editable}"/&gt;
              &lt;h:outputLabel value="#{c.cust_id}" rendered="#{not c.editable}" /&gt;
          &lt;/h:column&gt;
  
          &lt;h:column&gt;
          &lt;f:facet name="heder"&gt;User Name&lt;/f:facet&gt;
              &lt;h:inputText value="#{c.cust_name}" size="10" rendered="#{c.editable}"/&gt;
              &lt;h:outputLabel value="#{c.cust_name}" rendered="#{not c.editable}" /&gt;
          &lt;/h:column&gt;
  
          &lt;h:column&gt;              
              &lt;h:commandLink value="Update" rendered="#{c.editable}" action="#{customerdata.editAction(c)}" /&gt;
              &lt;h:commandLink value="Edit" action="#{customerdata.editAction(c)}" rendered="#{not c.editable}"/&gt;
          &lt;/h:column&gt;
  
          &lt;h:column&gt;              
              &lt;h:commandLink value="Delete" action="#{customerdata.deleteAction(c)}" /&gt;
          &lt;/h:column&gt;
  
  
          &lt;!-- Footer Setting --&gt;
          &lt;f:facet name="footer"&gt;
          &lt;h:panelGroup&gt;
              &lt;h:commandButton value="prev" action="#{customerdata.pagePrevious}"
                  disabled="#{customerdata.dataTable.first == 0}" /&gt;
              &lt;h:commandButton value="next" action="#{customerdata.pageNext}"
                  disabled="#{customerdata.dataTable.first + customerdata.dataTable.rows
                      &gt;= customerdata.dataTable.rowCount}" /&gt;
  
  
           &lt;/h:panelGroup&gt;
          &lt;/f:facet&gt;
  
      &lt;/h:dataTable&gt;
  </code></pre>
  
  <p>CustomerData.java</p>
  
  <pre><code>    package model;
  
  @ManagedBean(name="customerdata")
  public class CustomerData implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      Connection con;
      Statement smt;
      HtmlDataTable dataTable;
      //Customer cust=new Customer();
  
      public List&lt;Customer&gt; getcustomerList() throws SQLException{
          //System.out.println("in getcustomerlist");
          List&lt;Customer&gt; list= new ArrayList&lt;Customer&gt;();
          try{
  
              Class.forName("com.mysql.jdbc.Driver");
              con = DriverManager.getConnection("jdbc:mysql://localhost:3306/openid","root","root");
              smt = con.createStatement();
  
              String query="select * from jsftable";
              ResultSet rs= smt.executeQuery(query);
  
              while(rs.next()){
  
                  Customer cust = new Customer();
  
                  cust.setCust_id(rs.getInt("cust_id"));
                  cust.setCust_name(rs.getString("cust_name"));
                  cust.setHas_attachment(rs.getBoolean("has_attachment"));
                  System.out.println("in cusotomer data"+cust.isEditable());
                  //store all data into a List
                  list.add(cust);
              }
  
          }
          catch(Exception e){
              e.printStackTrace();
          }
      return list;
      }
  
      public void pageFirst() {
          dataTable.setFirst(0);
      }
  
      public void pagePrevious() {
          dataTable.setFirst(dataTable.getFirst() - dataTable.getRows());
          System.out.println("Prevoius"+dataTable.getFirst());
      }
  
      public void pageNext() {
          dataTable.setFirst(dataTable.getFirst() + dataTable.getRows());
          System.out.println("Next"+dataTable.getFirst());
      }
  
      public void pageLast() {
          int count = dataTable.getRowCount();
          int rows = dataTable.getRows();
          dataTable.setFirst(count - ((count % rows != 0) ? count % rows : rows));
      }
  
      public HtmlDataTable getdataTable() {
          return dataTable;
      }
  
      public void setdataTable(HtmlDataTable dataTable) {
          this.dataTable = dataTable;
      }
  
      public void showRow(){
          System.out.println(dataTable.getRows());
      }
      public String deleteAction(Customer customer) throws SQLException{
  
          //list.remove(customer);
          //System.out.println(customer.cust_id);
  
          try{
              Class.forName("com.mysql.jdbc.Driver");
              con = DriverManager.getConnection("jdbc:mysql://localhost:3306/openid","root","root");
              smt = con.createStatement();
  
              String query="delete from jsftable where cust_id="+customer.cust_id+"";
              //ResultSet rs= smt.executeQuery(query);
              smt.executeUpdate(query);
  
          }
          catch(Exception e){
  
              e.printStackTrace();
          }
  
          return null;
      }
  
      public String editAction(Customer customer) {
  
          //list.remove(customer);
          System.out.println(customer.cust_id);
  
          customer.setEditable(true);
          return null;
      }
  
  
  }
  </code></pre>
  
  <p>Customer.java</p>
  
  <pre><code>public class Customer {
  
  int cust_id;
  String cust_name;
  boolean has_attachment;
  boolean editable;
  String edit_value;
  
  
  public String getEdit_value() {
      System.out.println("in getter");
      return edit_value;
  }
  public void setEdit_value(String editvalue) {
      this.edit_value = editvalue;
  }
  public boolean isHas_attachment() {
      System.out.println("in getter of has_attach");
      return has_attachment;
  }
  public void setHas_attachment(boolean hasAttachment) {
      has_attachment = hasAttachment;
  }
  public int getCust_id() {
      System.out.println("in getter of cust_id");
      return cust_id;
  }
  public void setCust_id(int custId) {
      cust_id = custId;
  }
  public String getCust_name() {
      return cust_name;
  }
  public void setCust_name(String custName) {
      cust_name = custName;
  }
  public boolean isEditable() {
      //System.out.println("in isEditable"+editable);
      return editable;
  }
  public void setEditable(boolean editable) {
  
      this.editable = editable;
      //System.out.println("in set editable"+editable);
  }
  </code></pre>
  
  <p>}</p>