10 Replies Latest reply: Aug 23, 2011 12:52 AM by binh le quang RSS

    commandLink, commandButton in h:dataTable does not execute action

    Chris Moerz Newbie

      I've got a h:commandLink in a h:dataTable but for some reason the action is not getting executed. The action is not bound to any action in pages.xml, so it does not cause a redirect. To add to my confusion, I can rename the action to anythin except a completely invalid/non-existent function name (e.g. 123func would be illegal because that does not represent a valid Java method name) and no exception is thrown when clicking the link or button.


      I'm at a loss why this is happening. Here's my code:


      <h:dataTable value="#{dataItemList.selectedItem.notBefore}" var="nBitem"
          rowClasses="odd,even"
              columnClasses="extraTinyCol centered,defaultCol,defaultCol,defaultCol,tinyCol" >
                          
              <h:column>
                      <f:facet name="header">#</f:facet>
                      <s:div styleClass="viewSection">
                              <p style="text-align:center;padding:5px"><h:outputText value="#{nBitem.id}" /></p>
                      </s:div>
              </h:column>
                                              
              <h:column>
                      <f:facet name="header">#{messages['org.nycentral.labels.Description']}</f:facet>
                                      
                      <s:decorate template="../layout/display.xhtml">
                              <s:div styleClass="viewSection">
                                      <h:outputText value="#{nBitem.description}" escape="false" />
                              </s:div>
                      </s:decorate>                                     
              </h:column>
                                              
      
              <h:column>
                      <f:facet name="header">#{messages['org.nycentral.labels.Action']}</f:facet>
                      <h:commandLink action="#{dataItemList.switchItem(nBitem)}">
                              <h:graphicImage value="/img/fugue-icons/16x16/magnifier_arrow.png" 
                                      alt="#{messages['org.nycentral.labels.GoView']}"/>
                      </h:commandLink>
                      <h:commandButton action="#{dataItemList.select(nBitem)}" value="Go">
                      </h:commandButton>
              </h:column>
      </h:dataTable>            
      



      Does anyone have an idea why my commandLink doesn't work?? I do have working commandLinks that are in dataTables in my project; that's the only one that's broken and I'm really clueless as to how this is even possible?? I've been scratching my head over this for two days now and it's driving me nuts that such a stupid and totally simple thing holds me up for so long. Anyone, please, even if it's just a gut feeling what may be causing it, please tell me.


      thx in advance
      chris