0 Replies Latest reply on May 8, 2007 8:09 AM by Tobias Diederich

    Problem with valueChangeListener in inputText of a DataTable

    Tobias Diederich Newbie

      I write a program which should show Data in a Table and the user should be able to edit them.
      The Table has to be generated dynamicaly. For simplicity I create a table with 2 cols und 2 rows (see: getColumnModel() and getTableModel() in SessionBean). When I run the application there appears a problem.
      The valueChanged - Method is just called when I change the value of one of the two fields in the first column.
      Why isnt the Method called when I change the value of a field of the second column?

      My jsp-File looks as followed:
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>

      Vitax Web 1.0

      <h:form id="taxForm">
      <t:dataTable id="taxTable" var="row" value="#{taxTable.tableModel}">
      <t:columns value="#{taxTable.columnModel}" var="col">
      <f:facet name="header">
      <h:outputText value="#{col}" />
      <t:inputText id="in" value="#{row[taxTable.columnModel.rowIndex]}"
      valueChangeListener="#{taxTable.valueChanged}" immediate="true"

      Here is the code for the taxTable SessionBean:
      public class TaxTable {
      private javax.faces.model.ListDataModel tableModel;
      private javax.faces.model.ListDataModel columnModel;
      public SessionBean() {

      public void valueChanged(ValueChangeEvent evt) {
      System.out.println("Old Value: "+evt.getOldValue().toString());
      System.out.println("New Value: "+evt.getNewValue().toString());

      public javax.faces.model.ListDataModel getTableModel() {
      if(tableModel == null) {
      Object[] o1 = new Object[] {"Zeile 1", new Integer(1)};
      Object[] o2 = new Object[] {"", new Integer(2)};
      List<Object[]> l = new ArrayList<Object[]>();
      tableModel = new ListDataModel(l);
      return tableModel;

      public void setTableModel(javax.faces.model.ListDataModel tableModel) {
      this.tableModel = tableModel;

      public javax.faces.model.ListDataModel getColumnModel() {
      if(columnModel == null) {
      String[] o1 = new String[] {"Spalte1", "Spalte2"};
      List l = new ArrayList();
      columnModel = new ListDataModel(l);
      return columnModel;

      public void setColumnModel(javax.faces.model.ListDataModel columnModel) {
      this.columnModel = columnModel;

      I'm using myfaces1.1.4 (Tomahawk) and apache Tomcat5.5.20.
      Please help me.