1 Reply Latest reply on Apr 27, 2008 3:00 PM by Ken Clark

    commandButton not working in Clickable List

    Ken Clark Newbie

      I have a facelet page in which I have put together a clickable list.  The problem is, the commandButton actions do not seem to get called when the button is clicked.


      Anyone know what the problem might be?


      Note: I can change the action EL to anything I want, and it does not complain when there is no real managed bean that matches the EL.  It just redraws the page without seemingly calling any model code at all.


      Here is the facelet code:



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:s="http://jboss.com/products/seam/taglib"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:ice="http://www.icesoft.com/icefaces/component"
                      template="../layout/template.xhtml">
          
          <ui:define name="body">
              
              <h:messages globalOnly="true" styleClass="message"/>
              
              <ice:form id="selectVersionForm">
                  <ice:panelGrid id="homePanelGrid" columns="1" columnClasses="leftMenu,leftMenu">
                      <ice:panelGroup id="homePanelGroup">
                          
                          <h2>
                              <h:outputText value="List of Versions for Product "/>
                              <h:outputText value="#{versionAction.topNodeId}"/>
                          </h2>
                          
                          <h:dataTable value='#{versions}' var='version' border="1"
                                       cellpadding="2" cellspacing="0">
                              <h:column>
                                  <f:facet name="header">
                                      <h:outputText value="Version Title"/>
                                  </f:facet>
                                  <h:outputText id="versionTitle" value="#{version.versionTitle}"/>
                              </h:column>
                              <h:column>
                                  <f:facet name="header">
                                      <h:outputText value="Release Type"/>
                                  </f:facet>
                                  <h:outputText value="#{version.releaseType.releaseTypeDesc}"/>
                              </h:column>
                              <h:column>
                                  <f:facet name="header">
                                      <h:outputText value="Actions"/>
                                  </f:facet>
                                  <h:commandButton value="Edit" action="#{versionAction.editVersion}"/>
                              </h:column>
                              <h:column>
                                  <f:facet name="header">
                                      <h:outputText value="Delete"/>
                                  </f:facet>
                                  <h:commandButton value="Delete" action="#{versionAction.deleteVersion}"/>
                              </h:column>
                          </h:dataTable>
                          
                          <s:link id="addVersionLink" 
                                  action="#{versionAction.createVersion}" value="Add New Version">
                              <f:param name="topNodeId" value="#{versionAction.topNodeId}"/>
                          </s:link>
                          
                      </ice:panelGroup>
                  </ice:panelGrid>
              </ice:form>
              
          </ui:define> 
      </ui:composition>
      



      some of the action class code:



      @Stateful
      @Name("versionAction")
      public class VersionAction implements VersionActionLocal
      {
      
          @PersistenceContext
          private EntityManager em;
          @Logger
          private Log log;
          @Out(required = false)
          @In(required = false)
          private Version version;
          @DataModel
          private List<Version> versions;
          @DataModelSelection
          @Out(required=false)
          private Version selectedVersion;
          ...
      }
      



      The interface:



      public interface VersionActionLocal {
      
          public String cancel();
      
          public String createVersion();
      
          public String editVersion();
      
          public Converter getReleaseTypeConverter();
      
          public Long getTopNodeId ();
          
          public String listVersions();
      
          public void remove();
      
          public String removeVersion();
      
          public String save();
      
      }