10 Replies Latest reply on Feb 16, 2006 8:08 PM by Udo Krass

    Commandbutton doesn't work inside dataTable

    janbols Newbie

      When using a SFSB with SESSION scope, do you have to use a @Begin annotation?

      I have the following jsp page:

      <%@ page language="java" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <p>Page 1 </p>
       <h:messages />
       <h:commandButton action="#{sfsbSession.fillTable}" value="Fill table"/>
       <h:dataTable var="row" value="#{myTable}">
       <h:commandButton value="Go to page 2" action="#{sfsbSession.goToPage2}"/>
       <h:outputText value="#{row}"/>
       <h:commandButton value="Go to page 2" action="#{sfsbSession.goToPage2}"/>
      and the following SFSB with session scope:
      public class SFSBSessionAction implements SFSBSession, Serializable {
       private static final long serialVersionUID = -8231478684900323568L;
       @DataModel private List<String> myTable;
       public String fillTable() {
       myTable = new ArrayList<String>();
       return "page1";
       public String goToPage2() {return "page2";}
       @Destroy @Remove
       public void destroy() { }

      When I click on the commandButton below the dataTable, the goToPage2 method in my SFSB is invoked and I get page2. However, when I click on the commandButton inside the dataTable, nothing is invoked and page1 is returned with an empty dataTable.

      When I uncomment the @Begin annotation at the fillTabel method, everything works fine though.

      Is this the normal behaviour? Why?

      I'm using myfaces (nightly build version 12-13-2005), jBoss 4.0.3SP1 and seam beta1.