12 Replies Latest reply on Jan 22, 2010 7:25 AM by mark lewis

    a4j:commandButton hangs using rich:dataList

    mark lewis Newbie

      Hello


      I've got a fairly ordinary a4j command button which looks like this:

       

                          <a4j:commandButton value="Retrieve"
                              reRender="nodeConfig,currNode,lastOp" onclick="this.disabled=true"
                              oncomplete="this.disabled=false" />

       

      so I can use the reRender attribute to fill in data in an as yet unrendered form, and then render it (so the filled form appears after the button is clicked).  It works fine until I start using a rich:datalist.

       

      My backing bean contains this

       

          public void loadDataList() {
              dataList = new ArrayList();
              
      <snip>
                  TaskListData tldata = new TaskListData();    // contains some getters and setters only
                  String feedName = XMLHandler.getXMLValue("//feed[feed_id='" + feedId +"']" +"/feedname/text()");
                
                  tldata.setFeedName(feedName);
                  tldata.setFeedId(feedId);
                  dataList.add(tldata);
              }
          }

       

       

          public List<TaskListData> getDataList() {
              loadDataList();
              return dataList;
          }

       

      i've put in this code in my index.jsp:

       

                                  <h:form id="nodeDocConns" rendered="#{not empty PrismClient.dataList}">
                                       <rich:dataList var="nod" value="#{PrismBacking.dataList}">
                                           <h:outputText value="#{nod.feedName}"/><br/>
                                       </rich:dataList>
                                   </h:form>

       

      and the a4j:commandButton stays disabled as the function appears not to complete.  I've had this problem with rich:tree as well but I don't know why.  I'm sure it's not a bug, but can anyone suggest where I may be going wrong?

       

      Thanks

      Mark

        • 1. Re: a4j:commandButton hangs using rich:dataList
          Ilya Shaikovsky Master
          check please if there are any errors logged in a4j:log
          • 2. Re: a4j:commandButton hangs using rich:dataList
            mark lewis Newbie

            Hi Ilya,

            Thanks for the suggestion.  The a4j log turns up this on page load:

             

            debug[16:32:33,023]: Query preparation for form 'j_id_jsp_920730595_3' requested

            debug[16:32:33,024]: Append hidden control j_id_jsp_920730595_3_SUBMIT with value [1] and value attribute [1]

            debug[16:32:33,024]: Append hidden control javax.faces.ViewState with value [y3lGndORvmrBRSCBZMwzde4u6CieWsYUmgVxZo/mGuuM5HKl1VPl4GY9P+vk6SxCILXqjaUicux4p1B6LiI/d2rOqX7PBxwz] and value attribute [y3lGndORvmrBRSCBZMwzde4u6CieWsYUmgVxZo/mGuuM5HKl1VPl4GY9P+vk6SxCILXqjaUicux4p1B6LiI/d2rOqX7PBxwz]

            debug[16:32:33,024]: parameter j_id_jsp_920730595_3:poll with value j_id_jsp_920730595_3:poll

            debug[16:32:33,025]: Look up queue with default name

            debug[16:32:33,025]: NEW AJAX REQUEST !!! with form: j_id_jsp_920730595_3

            debug[16:32:33,025]: Start XmlHttpRequest

            debug[16:32:33,026]: Reqest state : 1

            debug[16:32:33,026]: QueryString: AJAXREQUEST=j_id_jsp_920730595_2&j_id_jsp_920730595_3_SUBMIT=1&javax.faces.ViewState=y3lGndORvmrBRSCBZMwzde4u6CieWsYUmgVxZo%2FmGuuM5HKl1VPl4GY9P%2Bvk6SxCILXqjaUicux4p1B6LiI%2Fd2rOqX7PBxwz&j_id_jsp_920730595_3%3Apoll=j_id_jsp_920730595_3%3Apoll&

            debug[16:32:33,029]: Reqest state : 1

            debug[16:32:33,076]: Reqest state : 2

            debug[16:32:33,077]: Reqest state : 4

            debug[16:32:33,077]: Reqest end with state 4

            debug[16:32:33,077]: Header Content-Type not found, search in <meta>

            debug[16:32:33,077]: Response with content-type: null

            debug[16:32:33,077]: Full response content:

            debug[16:32:33,078]: Header Ajax-Response not found, search in <meta>

            debug[16:32:33,078]: Header Ajax-Expired not found, search in <meta>

            warn[16:32:33,079]: No ajax response header

            debug[16:32:33,079]: Header Location not found, search in <meta>

            warn[16:32:33,079]: No content in response for replace current page

             

            and this when the button is clicked.


            debug[16:32:56,053]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: click
            debug[16:32:56,053]: Query preparation for form 'j_id_jsp_920730595_26' requested
            debug[16:32:56,054]: Append select-one control j_id_jsp_920730595_26:nodes with value [loncmss9710] and value attribute [null]
            debug[16:32:56,054]: Append hidden control j_id_jsp_920730595_26 with value [j_id_jsp_920730595_26] and value attribute [j_id_jsp_920730595_26]
            debug[16:32:56,054]: Append hidden control autoScroll with value [] and value attribute []
            debug[16:32:56,054]: Append hidden control javax.faces.ViewState with value [y3lGndORvmrBRSCBZMwzde4u6CieWsYUmgVxZo/mGuuM5HKl1VPl4GY9P+vk6SxCILXqjaUicux4p1B6LiI/d2rOqX7PBxwz] and value attribute [y3lGndORvmrBRSCBZMwzde4u6CieWsYUmgVxZo/mGuuM5HKl1VPl4GY9P+vk6SxCILXqjaUicux4p1B6LiI/d2rOqX7PBxwz]
            debug[16:32:56,054]: parameter j_id_jsp_920730595_26:j_id_jsp_920730595_32 with value j_id_jsp_920730595_26:j_id_jsp_920730595_32
            debug[16:32:56,054]: Look up queue with default name
            debug[16:32:56,055]: NEW AJAX REQUEST !!! with form: j_id_jsp_920730595_26
            debug[16:32:56,055]: Start XmlHttpRequest
            debug[16:32:56,056]: Reqest state : 1
            debug[16:32:56,056]: QueryString: AJAXREQUEST=j_id_jsp_920730595_0&j_id_jsp_920730595_26%3Anodes=loncmss9710&j_id_jsp_920730595_26=j_id_jsp_920730595_26&autoScroll=&javax.faces.ViewState=y3lGndORvmrBRSCBZMwzde4u6CieWsYUmgVxZo%2FmGuuM5HKl1VPl4GY9P%2Bvk6SxCILXqjaUicux4p1B6LiI%2Fd2rOqX7PBxwz&j_id_jsp_920730595_26%3Aj_id_jsp_920730595_32=j_id_jsp_920730595_26%3Aj_id_jsp_920730595_32&
            debug[16:32:56,059]: Reqest state : 1
            debug[16:32:56,079]: Reqest state : 2
            debug[16:32:56,080]: Reqest state : 4
            debug[16:32:56,080]: Reqest end with state 4
            debug[16:32:56,080]: Header Content-Type not found, search in <meta>
            debug[16:32:56,080]: Response with content-type: null
            debug[16:32:56,081]: Full response content:
            debug[16:32:56,081]: Header Ajax-Response not found, search in <meta>
            debug[16:32:56,081]: Header Ajax-Expired not found, search in <meta>
            warn[16:32:56,081]: No ajax response header
            debug[16:32:56,081]: Header Location not found, search in <meta>
            warn[16:32:56,081]: No content in response for replace current page

             

            Other than the ajax warnings there's nothing suspicious.  I can't find any references on the web re the warnings; your help is greatly appreciated - if I can fix this, I think I can finish the whole app without any further major problems.

            M

            • 3. Re: a4j:commandButton hangs using rich:dataList
              mark lewis Newbie

              Ilya, would you have said there is anything obvious in this output above?

              Thanks IA

              M

              • 4. Re: a4j:commandButton hangs using rich:dataList
                Ilya Shaikovsky Master
                And please consider that PrismClient should be session scoped because rendered attribute should not be pointed to request scoped objects.
                and check if there are any errors in server console.
                if nothing helps - please share sample in war with mock data to be run and investigated on our side.
                • 5. Re: a4j:commandButton hangs using rich:dataList
                  mark lewis Newbie

                  OK,

                  I've noticed that the inclusion of the datalist tag also stops my ajax clock from working (for reference, I posted about that originally here http://community.jboss.org/message/66321#66321).

                   

                  If I use an example index.jsp page:

                   

                  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
                  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                  <!-- RichFaces tag library declaration -->
                  <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                  <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                  <!-- JSTL XML lib declaration -->
                  <!-- error redirect -->
                  
                  <f:view>
                       <rich:page>
                            <h:panelGroup id="nodeConfig">
                            <h:form id="nodConfig" rendered="true">
                                 <!-- has to be client - i want all data there -->
                                 <rich:tabPanel switchType="client">
                                      <rich:tab styleClass="tab" label="Documented Connections">
                                           <h:panelGrid columns="2">
                                                <h:graphicImage value="/img/btnConnects50.png" width="30"
                                                     height="30" alt="Documented Connections" />
                                                <h:outputText value="DOCUMENTED CONNECTIONS: |#{PrismClient.chosenNode}|"
                                                     styleClass="pageTitle" />
                                           </h:panelGrid>
                                                     
                                           <h:form id="nodeDocConns">
                                                <rich:dataList      var="nod" value="#{PrismBacking.feedDataList}" 
                                                        rows="#{PrismBacking.feedDataListSize}"
                                                        type="none"
                                                        title="Documented Connections of |#{PrismClient.chosenNode}|">
                                                <h:outputText value="#{nod.feedName}"/><br/>
                                                <h:outputText value="#{nod.feedId}"/>
                                                </rich:dataList>
                                           </h:form>
                                      </rich:tab>
                                 </rich:tabPanel>
                            </h:form>
                            </h:panelGroup>
                       </rich:page>
                  </f:view>
                  

                   

                  and my backing bean produce a list which is displayed correctly.

                   

                  When I use a stripped down version of my index.jsp (the only change to the whole system is this index.jsp file) neither the ajax clock works and the retrieve button never completes.  There therefore must been a problem with the way I'm using tags and their interference with the ajax process but I can't understand why.  This is the index.jsp that doesn't work:

                   

                  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
                  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                  <!-- RichFaces tag library declaration -->
                  <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                  <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                  <!-- JSTL XML lib declaration -->
                  <!-- error redirect -->
                  <%@ page errorPage="errorPage.jsp"%>
                  
                  <f:loadBundle basename="messages" var="msg" />
                  
                  <f:view>
                       <rich:page pageTitle="Prism Configurator" markupType="xhtml">
                            <a4j:region>
                                 <h:form>
                                      <a4j:poll id="poll" interval="800" enabled="true"
                                           reRender="poll,grid" />
                                 </h:form>
                            </a4j:region>
                  
                            <f:facet name="header">
                                 <h:form>
                                      <h:outputText id="setup" value=" #{PrismBacking.setup}" />
                  
                                      <h:panelGrid columns="1" width="100%" id="grid">
                                           <span id="titleText">My title  </span>
                                           <h:outputText id="datum" value=" #{PrismBacking.dateTime}" />
                                      </h:panelGrid>
                                 </h:form>
                            </f:facet>
                  
                            <a4j:form>
                                 <h:outputText style="text-align: center" value="Select node " />
                                 <h:selectOneMenu id="nodes" value="#{PrismBacking.chosenNode}">
                                      <f:selectItems value="#{PrismBacking.nodes}" />
                                 </h:selectOneMenu>
                                 <a4j:commandButton value="Retrieve"
                                      reRender="nodeConfig" onclick="this.disabled=true"
                                      oncomplete="this.disabled=false" />
                       
                                      <h:form id="nodeConfig" rendered="#{not empty PrismBacking.chosenNode}">
                                           <h:panelGrid columns="2">
                                                <h:graphicImage value="/img/btnConnects50.png" width="30"
                                                     height="30" alt="Documented Connections" />
                                                <h:outputText value="DOCUMENTED CONNECTIONS: #{PrismBacking.chosenNode}"
                                                     styleClass="pageTitle" />
                                                <rich:dataList      var="nod" value="#{PrismBacking.feedDataList}" 
                                                                      rows="#{PrismBacking.feedDataListSize}"
                                                                       type="none"
                                                                       title="Documented Connections of |#{PrismClient.chosenNode}|">
                                                     <h:outputText value="#{nod.feedName}"/><br/>
                                                    <h:outputText value="#{nod.feedId}"/>
                                               </rich:dataList>     
                                           </h:panelGrid>
                                      </h:form>
                            </a4j:form>
                       </rich:page>
                  </f:view>
                  
                  

                   

                  It should be visible to a trained eye where the problem lies as it will definitely be between these two jsp files. Any pointers would be a big help.

                  Thanks

                  Mark

                  • 6. Re: a4j:commandButton hangs using rich:dataList
                    mark lewis Newbie

                    Taking the example working index.jsp page and pasting in just the clock-related tags:

                     

                                   <a4j:region>
                                   <h:form>
                                        <a4j:poll id="poll" interval="800" enabled="true"
                                             reRender="poll,grid" />
                                   </h:form>
                              </a4j:region>
                    
                              <f:facet name="header">
                                   <h:form>
                                        <h:outputText id="setup" value=" #{PrismBacking.setup}" />
                    
                                        <h:panelGrid columns="1" width="100%" id="grid">
                                             <span id="titleText">my title  </span>
                                             <h:outputText id="datum" value=" #{PrismBacking.dateTime}" />
                                        </h:panelGrid>
                                   </h:form>
                              </f:facet>
                         <a4j:log popup="false" level="ALL" style="width: 800px; height: 300px;"></a4j:log>
                    

                    I notice that with the datalist in place the clock doesn't work, from log:

                     

                    Request states 1 and 2 but NOT 3, then:
                    
                    debug[14:37:14,505]: Reqest state : 4
                    debug[14:37:14,505]: Reqest end with state 4
                    debug[14:37:14,506]: Header Content-Type not found, search in <meta>
                    debug[14:37:14,506]: Response with content-type: null
                    debug[14:37:14,506]: Full response content:
                    debug[14:37:14,507]: Header Ajax-Response not found, search in <meta>
                    debug[14:37:14,507]: Header Ajax-Expired not found, search in <meta>
                    warn[14:37:14,507]: No ajax response header
                    debug[14:37:14,507]: Header Location not found, search in <meta>
                    warn[14:37:14,507]: No content in response for replace current page
                    

                     

                    but if I take the datalist tags out

                    <request states 1 and 2 present then
                    debug[14:38:18,163]: Reqest state : 3
                    debug[14:38:18,164]: Reqest state : 4
                    debug[14:38:18,164]: Reqest end with state 4
                    debug[14:38:18,164]: Response with content-type: text/xml;charset=UTF-8
                    debug[14:38:18,164]: Full response content: <?xml version="1.0"?> ...
                     <loads of xml output re ajax requests ever 800 ms>
                    

                     

                     

                    This seems to be a problem with the use of datalist in an environment which also uses ajax.  But this can't possibly be a bug so can anyone see what I'm doing wrong? I'll be forever in their debt.

                     

                    Mark

                    • 7. Re: a4j:commandButton hangs using rich:dataList
                      mark lewis Newbie

                      OK Ilya,

                      Would attaching a war to a post submission be acceptable? I'm going out of my mind here.

                      Thanks

                      Mark

                      • 8. Re: a4j:commandButton hangs using rich:dataList
                        mark lewis Newbie

                        Here's a jar which should do the trick.  At this point, I'm willing to pay cash for a solution, as it's been close to 10 days trying to get a rich:datalist to output content on the same ajaxed page as another ajax element.

                        Mark

                        • 9. Re: a4j:commandButton hangs using rich:dataList
                          Ilya Shaikovsky Master
                          your app throws
                          javax.servlet.ServletException: /indexTest.jsp(21,4) ' #{PrismBacking.setup}' Error reading 'setup' on type PrismClient.PrismBacking
                          • 10. Re: a4j:commandButton hangs using rich:dataList
                            Ilya Shaikovsky Master
                            b.t.w. forms can't be nested in JSF.
                            1 of 1 people found this helpful
                            • 11. Re: a4j:commandButton hangs using rich:dataList
                              mark lewis Newbie

                              Sorry, indexTest.jsp wasn't supposed to be in there.

                              • 12. Re: a4j:commandButton hangs using rich:dataList
                                mark lewis Newbie
                                It didn't say anything about not nesting forms in jsf in the documentation... Do you think that is the cause of why the dataList tag's presence is causing a problem?