8 Replies Latest reply on Jul 27, 2009 9:51 AM by henry katz

    a4j:commandbutton clientid not found

    henry katz Newbie

      Hi,

      I've got a button:

      <a4j:commandButton id="showRRs" value="#{resourceKeys.rpt_select_risk_ratings}" styleClass="button"
       data="#{riskRatingReportFilterBackingBean.obligorPicked}"
       oncomplete="if(data)#{rich:component('changeRRModalPopup')}.show();" />


      and a test that clicks on it:

      // click button to raise popup
       client.click(selectRRBtn);


      where selectRRBtn = "showRRs" but the

      JSFClientSession.getElement() call doesn't seem to find this.

      I've tried the fully qualified construction:

      navSelectFormPicker:reportDynIncReport:showRRs

      also to no avail.

      The jsfServerSession.clientIDs.allClientIDs list does indeed contain the
      fully qualified construction in the JBDS 2.0.0 IDE.

      I'm using the following versions:

      MetafileRenderer-1197.jar
      ReportPrinter-1197.jar
      ReportViewer-1197.jar
      Serialization-1197.jar
      URIUtil-1197.jar
      XmlSchema-1.4.2.jar
      activation-1.1.jar
      annogen-0.1.0.jar
      ant-1.6.5.jar
      ant-1.7.0.jar
      ant-launcher-1.7.0.jar
      antlr-2.7.6.jar
      aopalliance-1.0.jar
      asm-1.5.3.jar
      asm-attrs-1.5.3.jar
      aspectjrt-1.5.2a.jar
      aspectjrt-1.5.4.jar
      aspectjtools-1.5.4.jar
      aspectjweaver-1.5.4.jar
      avalon-framework-4.1.3.jar
      axiom-api-1.2.7.jar
      axiom-dom-1.2.7.jar
      axiom-impl-1.2.7.jar
      axis2-1.4.1.jar
      axis2-adb-1.4.1.jar
      axis2-codegen-1.4.1.jar
      axis2-java2wsdl-1.4.1.jar
      axis2-kernel-1.4.1.jar
      axis2-spring-1.4.1.jar
      axis2-xmlbeans-1.4.1.jar
      backport-util-concurrent-3.1.jar
      c3p0-0.9.0.4.jar
      cactus-13-1.7.1.jar
      cactus-ant-13-1.7.1.jar
      cargo-0.5.jar
      cecore-1197.jar
      celib-1197.jar
      cglib-2.1_3.jar
      commons-beanutils-1.7.0.jar
      commons-beanutils-core-1.7.0.jar
      commons-codec-1.3.jar
      commons-collections-3.2.jar
      commons-configuration-1.2.jar
      commons-digester-1.6.jar
      commons-discovery-0.4.jar
      commons-el-1.0.jar
      commons-fileupload-1.2.1.jar
      commons-httpclient-3.1.jar
      commons-io-1.4.jar
      commons-lang-2.1.jar
      commons-logging-1.1.jar
      commons-logging-api-1.0.4.jar
      commons-math-1.1.jar
      commons-pool-1.3.jar
      commons-validator-1.3.1.jar
      cssparser-0.9.5.jar
      dom4j-1.6.1.jar
      dwr-2.0.5.jar
      ebus405-1197.jar
      ehcache-1.4.0.jar
      facestrace-0.8.1.jar
      geronimo-activation_1.1_spec-1.0.1.jar
      geronimo-javamail_1.4_spec-1.2.jar
      geronimo-jms_1.1_spec-1.1.jar
      geronimo-stax-api_1.0_spec-1.0.1.jar
      hibernate-3.2.5.ga.jar
      hibernate-annotations-3.3.0.ga.jar
      hibernate-commons-annotations-3.3.0.ga.jar
      hibernate-core-3.3.0.SP1.jar
      htmlunit-2.5.jar
      htmlunit-core-js-2.5.jar
      httpcore-4.0-beta1.jar
      httpcore-nio-4.0-beta1.jar
      httpunit-1.6.2.jar
      icu4j-1197.jar
      icu4j-2.6.1.jar
      jaxb-api-2.1.jar
      jaxen-1.1.1.jar
      jboss-jsfunit-analysis-1.1.0.GA-SNAPSHOT.jar
      jboss-jsfunit-ant-1.1.0.GA-SNAPSHOT.jar
      jboss-jsfunit-core-1.1.0.GA-SNAPSHOT.jar
      jboss-jsfunit-richfaces-1.1.0.GA-SNAPSHOT.jar
      jdom-1.0.jar
      jep-3.3.0.jar
      jrcadapter-1197.jar
      jrcerom-1197.jar
      js-1.7R1.jar
      jsf-facelets-1.1.15.B1.jar
      jsr107cache-1.0.jar
      jsr250-api-1.0.jar
      jstl-1.1.2.jar
      jta-1.0.1B.jar
      jtidy-4aug2000r7-dev.jar
      junit-3.8.1.jar
      keycodeDecoder-1197.jar
      logkit-1.0.1.jar
      mail-1.4.jar
      neethi-2.0.4.jar
      nekohtml-1.9.9.jar
      oro-2.0.8.jar
      persistence-api-1.0.jar
      phaseTracker-unknown.jar
      poi-3.2-FINAL.jar
      pullparser-1197.jar
      rasapp-1197.jar
      rascore-1197.jar
      richfaces-api-3.3.0.GA.jar
      richfaces-impl-3.3.0.GA.jar
      richfaces-ui-3.3.0.GA.jar
      rpoifs-1197.jar
      saaj-api-1.3.jar
      saaj-impl-1.3.jar
      sac-1.3.jar
      serializer-2.7.1.jar
      sjsxp-1.0.1.jar
      slf4j-api-1.4.3.jar
      slf4j-simple-1.4.3.jar
      spring-2.5.jar
      spring-aop-2.0.8.jar
      spring-beans-2.5.1.jar
      spring-context-2.0.8.jar
      spring-core-2.0.8.jar
      spring-security-core-2.0.4.jar
      spring-support-2.0.8.jar
      spring-web-2.5.1.jar
      spring-ws-1.5.2.jar
      stax-api-1.0.1.jar
      stax-api-1.0.jar
      tag-handlers-0.9.jar
      tomahawk-1.1.6.jar
      woden-api-1.0M8.jar
      woden-impl-dom-1.0M8.jar
      wsdl4j-1.6.2.jar
      wstx-asl-3.2.4.jar
      xalan-2.7.1.jar
      xercesImpl-2.4.0.jar
      xml-apis-1.0.b2.jar
      xmlParserAPIs-2.6.0.jar
      xmlbeans-2.3.0.jar
      xom-1.0.jar
      xpp3_min-1.1.4c.jar
      xstream-1.3.1.jar


      Any suggestions to improve resolution?

      Thanks,
      Henry

        • 1. Re: a4j:commandbutton clientid not found
          Stan Silvert Master

          Is there a popup window showing? If so then JSFClientSession might be looking at the popup instead of the main page. You can check to see what JSFClientSession is looking at if you call getPageAsText(). Then you can double-check to see if the showRRs component is in the HTML.

          For dealing with multiple windows in JSFUnit, see the bottom of this page:
          http://www.jboss.org/community/wiki/UsingtheHtmlUnitAPIwithJSFUnit

          Stan

          • 2. Re: a4j:commandbutton clientid not found
            henry katz Newbie

             

            "stan.silvert@jboss.com" wrote:
            Is there a popup window showing? If so then JSFClientSession might be looking at the popup instead of the main page. You can check to see what JSFClientSession is looking at if you call getPageAsText(). Then you can double-check to see if the showRRs component is in the HTML.

            Stan,

            The button is intended to invoke a popup, but is not itself within one. getPageAsText().contains("showRRs") does not find it. Dumping the entire getPageAsText() to the log file allows me to determine that a rich:messages with an id does appear but the rest of the facelet seems to have vanished.

            Here's the relevant portion of the facelet below:


            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
             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:rich="http://richfaces.org/rich"
             xmlns:a4j="http://richfaces.org/a4j">
            
             <f:loadBundle basename="com.foobar.cre.messageresource.CreResources" var="resourceKeys"/>
            
             <ui:include src="/content/reporting/popups/riskRatingPopup.xhtml"/>
            
             <rich:messages id="rrRepFilterMsg" />
            
             <div>
             <div class="collapsable_content" style='width: 100%;'>
             <a4j:outputPanel id="ofs-tbl31" >
             <h:panelGrid id="rrObligorList" columns="2">
             <h:outputText value="#{resourceKeys.rpt_select_obligor}" styleClass="input_select_label"/>
             <h:selectOneListbox id="selectedRR"
             value="#{riskRatingReportFilterBackingBean.selectedObligorId}"
             style="width: 150px;" size="1" styleClass="textSmall" >
             <f:selectItems value="#{riskRatingReportFilterBackingBean.obligorList}"/>
             <a4j:support event="onchange" reRender="rrRepFilterMsg,orrList"
             action="#{riskRatingReportFilterBackingBean.selectObligorRiskRatings}" limitToList="true"/>
             </h:selectOneListbox>
             <h:outputText value="" styleClass="input_select_label"/>
             <a4j:commandButton id="showRRs" value="#{resourceKeys.rpt_select_risk_ratings}" styleClass="button"
             data="#{riskRatingReportFilterBackingBean.obligorPicked}"
             oncomplete="if(data)#{rich:component('changeRRModalPopup')}.show();" />
             </h:panelGrid>
             </a4j:outputPanel>
             <br class="clear" />
            



            For dealing with multiple windows in JSFUnit, see the bottom of this page:
            http://www.jboss.org/community/wiki/UsingtheHtmlUnitAPIwithJSFUnit

            I just queried the WebWindows to ensure I was where I though I was in the test and no - I'm still in the main page not yet having fired the button
            (because it couldn't be found).

            Could the "data" attribute be confusing it?

            Thanks,
            Henry


            Stan


            • 3. Re: a4j:commandbutton clientid not found
              Stan Silvert Master

              If the component doesn't show up in getPageAsText() then I assume it is a problem with your application. To triple-check, run the app in your browser and see if the component shows up when you "View Source".

              Stan

              • 4. Re: a4j:commandbutton clientid not found
                henry katz Newbie

                 

                "stan.silvert@jboss.com" wrote:
                If the component doesn't show up in getPageAsText() then I assume it is a problem with your application. To triple-check, run the app in your browser and see if the component shows up when you "View Source".

                Stan


                Stan,

                What you are saying is correct. The portion of the facelet that is causing these headaches is within an a4j:include. Apparently this is not seen by the client side. Are there any known workarounds here?

                Thanks,
                Henry

                • 5. Re: a4j:commandbutton clientid not found
                  Stan Silvert Master

                  The a4j:include isn't working? Even when you look at the page with your browser?

                  If so, then it's strictly an A4J problem. If you post more details I'll try to help you but the problem would be better addressed on the RichFaces forum.

                  Stan

                  • 6. Re: a4j:commandbutton clientid not found
                    henry katz Newbie

                     

                    "stan.silvert@jboss.com" wrote:
                    The a4j:include isn't working? Even when you look at the page with your browser?

                    If so, then it's strictly an A4J problem. If you post more details I'll try to help you but the problem would be better addressed on the RichFaces forum.

                    Stan


                    Stan,

                    To clarify - the a4j:include works perfectly within the browser running the app. Even then the clientid is not detectable debugging the jsfunit test looking within the clientside getPageAsText() data.

                    Here's a few snippets to illustrate:

                    The top facelet includes many other components and based on what the
                    user selects, a different viewId will be used to render the final lower panel.

                    <h:panelGrid id="reportSelPanelGrid" columns="1" width="100%" columnClasses="topAlign" border="0">
                     <a4j:form id="navSelectFormPicker">
                     <rich:panel headerClass="cre_richPanelHeader" bodyClass="collapsable_content">
                     <f:facet name="header">
                     <h:outputText value="#{resourceKeys.rpt_select_obligorvw}"/>
                     </f:facet>
                     <ui:include src="/content/reporting/filters/obligorSelector.xhtml"/>
                     </rich:panel>
                     <a4j:outputPanel id="obligorPicked">
                     <h:panelGrid columns="1" rendered="#{reportSelectNavBean.obligorViewSelected}">
                     <ui:include src="/content/reporting/filters/reportTypeSelector.xhtml"/>
                     <ui:include src="/content/reporting/filters/reportCategorySelector.xhtml"/>
                     </h:panelGrid>
                     </a4j:outputPanel>
                     <a4j:outputPanel id="selectRestPanel">
                     <rich:panel id="reportTreePanelInc" styleClass="topAlign" rendered="#{reportSelectNavBean.reportTypeSelected}">
                     <a4j:include id="reportDynIncReport" viewId="#{reportSelectNavBean.viewId}" binding="#{reportSelectNavBean.include}" ajaxRendered="true"/>
                     </rich:panel>
                     </a4j:outputPanel>
                     </a4j:form>
                     </h:panelGrid>


                    In the particular test which I am running, the viewId will render the following facelet:

                    <a4j:outputPanel id="filterErrorMessage">
                     <h:messages/>
                     </a4j:outputPanel>
                     <div class="collapsable_header">
                     <h4><h:outputText value="#{riskRatingReportBackingBean.name}" /></h4>
                     </div>
                     <ui:include src="/content/reporting/filters/riskRatingReportFilter.xhtml"/>
                     <br class="clear" />
                    .
                    .
                    .
                    


                    where none of the clientId's seen above are visible using the clientside
                    getPageAsText() aside from one in the riskRatingReportFilter.xhtml:




                     <ui:include src="/content/reporting/popups/riskRatingPopup.xhtml"/>
                     <rich:messages id="rrRepFilterMsg" />
                     <h:panelGrid id="rrDummy" columns="2"/>
                     <div>
                     <div class="collapsable_content" style='width: 100%;'>
                     <a4j:outputPanel id="ofs-tbl31" >
                     <h:panelGrid id="rrObligorList" columns="2">
                     <h:outputText value="#{resourceKeys.rpt_select_obligor}" styleClass="input_select_label"/> .
                    .
                    .
                    .
                    


                    where only the rrRepFilterMsg is visible in the clientside getPageAsText().
                    The rrDummy clientId was put in as a test - but it isn't visible either.

                    So my working hypothesis is that nothing within the a4j:include (or isolated points only) are visible for jsfunit test purposes.

                    I'll try a standalone test case with a4j:include alone to rule out the component itself.

                    Thanks,
                    Henry

                    • 7. Re: a4j:commandbutton clientid not found
                      Stan Silvert Master

                       

                      "freemarket" wrote:


                      I'll try a standalone test case with a4j:include alone to rule out the component itself.

                      Hi Henry,

                      Have you been able to isolate the problem with your standalone test?

                      I noticed that you need to upgrade your commons-lang jar to version 2.4. Also, for some jars you have two versions listed. Only use the latest version in your application.

                      You don't need to bundle jboss-jsfunit-ant-1.1.0.GA-SNAPSHOT.jar inside your WAR. That is only used for building a JSFUnit-ized WAR with ant. You probably don't need jboss-jsfunit-analysis-1.1.0.GA-SNAPSHOT.jar unless you are running the JSFUnit static analysis tests.

                      So cleaning up the jars in your WAR might help, but I'm really more interested in your latest efforts to narrow down the problem.

                      BTW, which app server/servlet container are you using?

                      Regards,

                      Stan

                      • 8. Re: a4j:commandbutton clientid not found
                        henry katz Newbie

                         

                        "stan.silvert@jboss.com" wrote:
                        "freemarket" wrote:


                        I'll try a standalone test case with a4j:include alone to rule out the component itself.

                        Hi Henry,

                        Have you been able to isolate the problem with your standalone test?

                        I noticed that you need to upgrade your commons-lang jar to version 2.4. Also, for some jars you have two versions listed. Only use the latest version in your application.

                        You don't need to bundle jboss-jsfunit-ant-1.1.0.GA-SNAPSHOT.jar inside your WAR. That is only used for building a JSFUnit-ized WAR with ant. You probably don't need jboss-jsfunit-analysis-1.1.0.GA-SNAPSHOT.jar unless you are running the JSFUnit static analysis tests.

                        So cleaning up the jars in your WAR might help, but I'm really more interested in your latest efforts to narrow down the problem.

                        BTW, which app server/servlet container are you using?

                        Regards,

                        Stan


                        Hi Stan,

                        Let me try your jar changes. Still testing a reduced a4j:include construct.
                        The container is jboss 4.2.3GA.

                        Regards,
                        Henry