0 Replies Latest reply on May 11, 2012 5:23 AM by Marc Marco

    problems with a4j:queue  and a4j:attachQueue

    Marc Marco Newbie

      Hi All,

      I have some problems with the execution of my queue in my Richfaces application. I have implemented a small Richfaces application with Ajax request. Every request should be queued and fired after 2 second.

      <a4j:queue requestDelay="2000" ignoreDupResponses="true"></a4j:queue>

       

      I want that, if the User clicks on an item of the DropDownMenu 1 and than on  an item of the DropDownMenu 2, only one request should be sent.That means, the user clicks Quinie of the DropDownMenu 1  and at the same time clicks Pierrette of the DropDownMenu 2, only one request should be send ,that means the expected name should Pierrette from the last request . At the moment i receive two names from the same queue  Quinie and after 2 seconds Pierrette. That is not what i,ve expected.

      I use Richfaces 4 and JSF 2.0 ,Could someone help me please ?

       

      Thanks in advance

       

      Hier is my xhtml code :

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:rich="http://richfaces.org/rich"

          xmlns:a4j="http://richfaces.org/a4j">

       

      <h:body>

          <h:head>

              <title>Queue demo</title>

          </h:head>

       

          <h2>JSF and RichFaces Queue</h2>

          <a4j:queue requestDelay="2000" ignoreDupResponses="true"></a4j:queue>

          <h:form>

            <rich:panel>          

                   <h:panelGrid columns="2">

                      <h:selectOneMenu value="#{queueBean.username}">

                             <f:selectItem itemValue="Quinie" itemLabel="Quinie" />

                             <f:selectItem itemValue="William" itemLabel="William" />

                             <f:selectItem itemValue="Aron" itemLabel="Aron" />

                             <f:selectItem itemValue="Faith" itemLabel="Faith" />

                             <f:selectItem itemValue="Divine" itemLabel="Divine" />                      

                             <a4j:attachQueue requestGroupingId="group1"/>

                             <a4j:ajax event="change" execute="@this" render="rep"/>                                                                  

                      </h:selectOneMenu>

                     

                       <h:selectOneMenu value="#{queueBean.username}">

                          <f:selectItem itemValue="Pierrette" itemLabel="Pierrette" />

                             <f:selectItem itemValue="Biblias" itemLabel="Biblias" />

                             <f:selectItem itemValue="Pauline" itemLabel="Pauline" />

                             <f:selectItem itemValue="Francois" itemLabel="Francois" />   

                          <a4j:attachQueue requestGroupingId="group1"/>   

                          <a4j:ajax event="change" execute="@this" render="rep"/>                                                             

                      </h:selectOneMenu>                

                     

                   </h:panelGrid>

              </rich:panel>

              

              <rich:panel>          

                  <h:outputText id="rep" value="Selected Name : #{queueBean.username}" />

              </rich:panel>

             

              <br></br><br></br>

              <h:panelGrid columns="2">

                  <h:commandButton value="Next queue demo" style="float:right" action="queuedemo2" />

                  <h:commandButton value="Previous" style="float:left" action="index" />

              </h:panelGrid>

          </h:form>

      </h:body>

      </html>

       

      hier is my bean

       

      @ManagedBean

      @RequestScoped

      public class QueueBean {

          private String    username;

         

       

          public String getUsername() {

              return this.username;

          }

       

          public void setUsername(String username) {

              this.username = username;

          }

         

      }