2 Replies Latest reply on Aug 4, 2010 4:25 AM by Ilya Shaikovsky

    action and actionListener not called on server side using a4j:commandLink

    Atle Prange Newbie

      Hi,

       

      i have been trying to call a method on a bean using a4j:commandLink, but i have not been able to get it working right. I have double checked for nested forms.

       

      If i replce a4j: with h:, the action is executed on server side as expected.

       

      What really puzzles me is the i can replace my method binding expression with any bogus expression, the behavior is the same. No exceptions are thrown (but it should?), and no action being called (of course, since the binding is bogus)

       

      Any pointers and hints are highly appreciated

       

      Here is the calling code

       

      <ui:define name="body">
       
        <div style="border:1px solid gray;">
          <a4j:outputPanel id="rightslist1">
            <h:form id="rightlistform">
       
               <s:div rendered="#{pointHome.rightsList.newItem}">
                  New item
               </s:div>
               <s:span  rendered="#{!pointHome.rightsList.newItem and pointHome.writeAllowed}">Not new mode</s:span>
               <s:span  rendered="#{pointHome.rightsList.newItem and pointHome.writeAllowed}">New mode</s:span>
               <a4j:commandLink id="aa" reRender="rightslist1" value="#{messages['editlist.cancel']}" ajaxSingle="true" actionListener="#{pointHome.rightsList.cancel()}"/>
             </h:form>
       
          </a4j:outputPanel>
       
          ...
          ...
        </div>
        ...
        ...
      <ui:define>
      

       

       

      Here is the bean i am trying to call

       

      @Name("pointHome")
      @Scope(ScopeType.SESSION)
      @AutoCreate
      public class SupplyPointHome extends EntityHome<SupplyPoint> {
      
        ...
        public RightsList getRightsList() {
          return rightsList;
        }
        ...
      
      }
      
      
      
      public class RightsList extends EditList<Permission, RightsItem> {
      
        ...
        public void cancel() {
          client.logDebug( "Cancel pressed on #0", this );
          editMode = false;
        }
        ...
      
      }
      
      

       

       

      This is the output from the a4j:log component

       

       

      debug[9:42:28,339]: Have Event [object Object] with properties: target: 
      http://texi4:8080/tls2/point/points.seam#, srcElement: http://texi4:8080/tls2/point/points.seam#, type: click
      debug[9:42:28,339]: Query preparation for form 'tabs:1:j_id61:rightlistform' requested
      debug[9:42:28,340]: Append hidden control tabs:1:j_id61:rightlistform with value 
      [tabs:1:j_id61:rightlistform] and value attribute [tabs:1:j_id61:rightlistform]
      debug[9:42:28,340]: Append hidden control javax.faces.ViewState with value [H4sIAAAAAAAA ...
      debug[9:42:28,340]: parameter tabs:1:j_id61:rightlistform:aa with value tabs:1:j_id61:rightlistform:aa
      debug[9:42:28,340]: parameter ajaxSingle with value tabs:1:j_id61:rightlistform:aa
      debug[9:42:28,340]: Look up queue with default name
      debug[9:42:28,340]: NEW AJAX REQUEST !!! with form: tabs:1:j_id61:rightlistform
      debug[9:42:28,340]: Start XmlHttpRequest
      debug[9:42:28,340]: Request state : 1
      debug[9:42:28,343]: QueryString: AJAXREQUEST=tabs%3A1%3Aj_id61%3Aj_id63&tabs%3A1%3Aj_id61%3Arigh
      tlistform=tabs%3A1%3Aj_id61%3Arightlistform&javax.faces.ViewState=H4s ...
      debug[9:42:28,459]: Request state : 2
      debug[9:42:28,459]: Request state : 3
      debug[9:42:28,459]: Request state : 3
      debug[9:42:28,459]: Request state : 3
      debug[9:42:28,460]: Request state : 3
      debug[9:42:28,460]: Request state : 3
      debug[9:42:28,489]: Request state : 3
      debug[9:42:28,489]: Request state : 3
      debug[9:42:28,490]: Request state : 3
      debug[9:42:28,490]: Request state : 3
      debug[9:42:28,490]: Request state : 3
      debug[9:42:28,490]: Request state : 3
      debug[9:42:28,490]: Request state : 3
      debug[9:42:28,490]: Request state : 3
      debug[9:42:28,490]: Request state : 3
      debug[9:42:28,490]: Request state : 3
      debug[9:42:28,491]: Request state : 3
      debug[9:42:28,491]: Request state : 3
      debug[9:42:28,491]: Request state : 3
      debug[9:42:28,491]: Request state : 3
      debug[9:42:28,491]: Request state : 3
      debug[9:42:28,491]: Request state : 3
      debug[9:42:28,491]: Request state : 3
      debug[9:42:28,491]: Request state : 3
      debug[9:42:28,492]: Request state : 4
      debug[9:42:28,492]: Request end with state 4
      debug[9:42:28,492]: Response with content-type: text/xml;charset=UTF-8
      debug[9:42:28,492]: Full response content: LEFT OUT DUE TO SIZE....
      debug[9:42:28,494]: Header Ajax-Expired not found, search in <meta>
      debug[9:42:28,494]: search for elements by name 'meta' in element #document
      debug[9:42:28,494]: Find <meta name='Ajax-Update-Ids' content='j_id38'>
      debug[9:42:28,494]: Find <meta name='Ajax-Response' content='true'>
      debug[9:42:28,495]: Find <meta name='Ajax-Update-Ids' content='j_id38'>
      debug[9:42:28,495]: Find <meta name='Ajax-Response' content='true'>
      debug[9:42:28,495]: Header Ajax-Update-Ids not found, search in <meta>
      debug[9:42:28,495]: search for elements by name 'meta' in element #document
      debug[9:42:28,495]: Find <meta name='Ajax-Update-Ids' content='j_id38'>
      debug[9:42:28,495]: Update page by list of rendered areas from response j_id38
      debug[9:42:28,495]: search for elements by name 'script' in element #document
      debug[9:42:28,495]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript
      debug[9:42:28,495]: Such element exist in document
      debug[9:42:28,495]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript
      debug[9:42:28,496]: Such element exist in document
      debug[9:42:28,496]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/available.js
      debug[9:42:28,496]: Such element exist in document
      debug[9:42:28,496]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/jquery/jquery.js
      debug[9:42:28,496]: Such element exist in document
      debug[9:42:28,496]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/script/controlUtils.js
      debug[9:42:28,496]: Such element exist in document
      debug[9:42:28,496]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/utils.js
      debug[9:42:28,496]: Such element exist in document
      debug[9:42:28,496]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/browser_info.js
      debug[9:42:28,496]: Such element exist in document
      debug[9:42:28,496]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanel.js
      debug[9:42:28,496]: Such element exist in document
      debug[9:42:28,496]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanelBorders.js
      debug[9:42:28,497]: Such element exist in document
      debug[9:42:28,497]: <script> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js
      debug[9:42:28,497]: Such element exist in document
      debug[9:42:28,497]: search for elements by name 'link' in element #document
      debug[9:42:28,497]: <link> in response with src=/tls2/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_
      debug[9:42:28,497]: Such element exist in document
      debug[9:42:28,497]: <link> in response with src=/tls2/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_
      debug[9:42:28,497]: Such element exist in document
      debug[9:42:28,497]: <link> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/css/msg.css
      debug[9:42:28,497]: Such element exist in document
      debug[9:42:28,497]: <link> in response with src=/tls2/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/css/msgs.css
      debug[9:42:28,498]: Such element exist in document
      debug[9:42:28,498]: <link> in response with src=/tls2/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/modalPanel.xcss/DATB/eAELXT5DOhSIAQ!sA18_
      debug[9:42:28,498]: Such element exist in document
      debug[9:42:28,498]: call getElementById for id= org.ajax4jsf.queue_script
      debug[9:42:28,498]: Update page part from call parameter for ID j_id38
      debug[9:42:28,498]: call getElementById for id= j_id38
      debug[9:42:28,498]: Replace content of node by outerHTML()
      debug[9:42:28,499]: search for elements by name 'script' in element table
      debug[9:42:28,499]: Scripts in updated part count : 0
      debug[9:42:28,499]: call getElementById for id= org.ajax4jsf.oncomplete
      debug[9:42:28,499]: Processing updates finished, no oncomplete function to call
      debug[9:42:28,499]: Update part of page for Id: j_id38 successful
      debug[9:42:28,499]: call getElementById for id= ajax-view-state
      debug[9:42:28,499]: Hidden JSF state fields: [object HTMLElement]
      debug[9:42:28,500]: Namespace for hidden view-state input fields is undefined
      debug[9:42:28,500]: search for elements by name 'input' in element span
      debug[9:42:28,500]: Replace value for inputs: 88 by new values: 1
      debug[9:42:28,500]: Input in response: javax.faces.ViewState
      debug[9:42:28,500]: Found same input on page with type: hidden
      debug[9:42:28,500]: Found same input on page with type: hidden
      debug[9:42:28,501]: Found same input on page with type: hidden
      debug[9:42:28,501]: Found same input on page with type: hidden
      debug[9:42:28,501]: Found same input on page with type: hidden
      debug[9:42:28,501]: Found same input on page with type: hidden
      debug[9:42:28,501]: Found same input on page with type: hidden
      debug[9:42:28,501]: Found same input on page with type: hidden
      debug[9:42:28,501]: Found same input on page with type: hidden
      debug[9:42:28,501]: Found same input on page with type: hidden
      debug[9:42:28,502]: Found same input on page with type: hidden
      debug[9:42:28,502]: Found same input on page with type: hidden
      debug[9:42:28,502]: Found same input on page with type: hidden
      debug[9:42:28,502]: Found same input on page with type: hidden
      debug[9:42:28,502]: Found same input on page with type: hidden
      debug[9:42:28,502]: Found same input on page with type: hidden
      debug[9:42:28,502]: Found same input on page with type: hidden
      debug[9:42:28,502]: Found same input on page with type: hidden
      debug[9:42:28,503]: Found same input on page with type: hidden
      debug[9:42:28,503]: Found same input on page with type: hidden
      debug[9:42:28,503]: Found same input on page with type: hidden
      debug[9:42:28,503]: Found same input on page with type: hidden
      debug[9:42:28,503]: Found same input on page with type: hidden
      debug[9:42:28,503]: Found same input on page with type: hidden
      debug[9:42:28,503]: Found same input on page with type: hidden
      debug[9:42:28,503]: Found same input on page with type: hidden
      debug[9:42:28,504]: Found same input on page with type: hidden
      debug[9:42:28,504]: Found same input on page with type: hidden
      debug[9:42:28,504]: search for elements by name 'INPUT' in element span
      debug[9:42:28,504]: Replace value for inputs: 88 by new values: 0
      debug[9:42:28,504]: call getElementById for id= _A4J.AJAX.focus
      debug[9:42:28,504]: No focus information in response
      
      
      
      
      

       

       

       

      Here is the lifecycle on the server

       

       

      2010-08-04 09:42:31,801 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker beforePhase
      INFO: BEFORE RESTORE_VIEW 1
      2010-08-04 09:42:31,839 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker afterPhase
      INFO: AFTER RESTORE_VIEW 1
      2010-08-04 09:42:31,840 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker beforePhase
      INFO: BEFORE APPLY_REQUEST_VALUES 2
      2010-08-04 09:42:31,841 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker afterPhase
      INFO: AFTER APPLY_REQUEST_VALUES 2
      2010-08-04 09:42:31,842 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker beforePhase
      INFO: BEFORE PROCESS_VALIDATIONS 3
      2010-08-04 09:42:31,842 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker afterPhase
      INFO: AFTER PROCESS_VALIDATIONS 3
      2010-08-04 09:42:31,843 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker beforePhase
      INFO: BEFORE UPDATE_MODEL_VALUES 4
      2010-08-04 09:42:31,844 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker afterPhase
      INFO: AFTER UPDATE_MODEL_VALUES 4
      2010-08-04 09:42:31,845 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker beforePhase
      INFO: BEFORE INVOKE_APPLICATION 5
      2010-08-04 09:42:31,845 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker afterPhase
      INFO: AFTER INVOKE_APPLICATION 5
      2010-08-04 09:42:31,848 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker beforePhase
      INFO: BEFORE RENDER_RESPONSE 6
      2010-08-04 09:42:31,894 ERROR [STDERR                                  ] Aug 4, 2010 9:42:31 AM org.exadel.jsf.PhaseTracker afterPhase
      INFO: AFTER RENDER_RESPONSE 6
      

       

       

      And finally my web.xml

       

       

      <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      
           <context-param>
                <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                <param-value>com.sun.facelets.FaceletViewHandler</param-value>
           </context-param>
      
           <context-param>
                <param-name>org.jboss.seam.core.init.debug</param-name>
                <param-value>true</param-value>
           </context-param>
      
           <context-param>
                <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
                <param-value>NONE</param-value>
           </context-param>
      
           <context-param>
                <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                <param-value>client</param-value>
           </context-param>
      
           <!-- Seam -->
           <listener>
                <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
           </listener>
      
      
           <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
           </context-param>
      
      
           <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
           </servlet>
      
           <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.seam</url-pattern>
           </servlet-mapping>
      
           <servlet>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
           </servlet>
      
           <servlet-mapping>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <url-pattern>/seam/resource/*</url-pattern>
           </servlet-mapping>
      
      
           <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
           </filter>
      
           <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
           </filter-mapping>
      
           <session-config>
                <session-timeout>60</session-timeout>
           </session-config>
      
      </web-app>
      

      I use

      Facelets 1.14

      Seam 2.2.1

      Richfaces 3.3.3

      JBoss 4.2.2

       

       

      -atle