2 Replies Latest reply on May 19, 2010 9:33 AM by Eric Ettes

    Too many requests? (rich:Calendar)

    Eric Ettes Newbie

      Hello everyone,


      I'm having a question about the usage of the rich:calendar component --


      I have a table that is filled whenever I choose another date on the calendar. This seems to work, but when I view the logging, I see the following events:


      • table 'getters' are called, filling the table with the old data
      • setter is called
      • table 'getters' are called again, this time with the updated data


      Every table getter currently fires a query to a database, and what I want to achieve is only one query, after the date is updated.


      I'm using the latest version of Richfaces, and JSF 2.0. The application is deployed on Tomcat 6 (We're currently migrating to jBoss though ;-))


      My current code looks like this:







      <rich:panel styleClass="panel">


         <h:outputLabel for="calendar" value="Date:" />


         <a4j:outputPanel id="calendar" layout="block" >


            <rich:calendar value="#{mainBean.selectedDate}" popup="true"

               datePattern="yyyy-MM-dd" showApplyButton="false" cellWidth="24px" cellHeight="22px" >


               <a4j:support event="onchanged" reRender="curDate" />






         <h:outputText id="curDate" value="#{mainBean.selectedDate}" />





      MainBean.java (the relevant methods)



      public class MainManagedBean extends ManagedBean {

        private Date selectedDate;

        public List<DashBoardBean> getMockUpDashboard() {

          System.out.println("Getting mockup data");

          return mockUpDashboard;


        public void changeSendDate(CurrentDateChangeEvent event) {

          System.out.println("ValueChangeEvent: " + event.getCurrentDate());

          FacesContext.getCurrentInstance().renderResponse();     // This doesn't seem to fix my problem    


        public Date getSelectedDate() {

          return selectedDate;


        public void setSelectedDate(Date selectedDate) {

          System.out.println("Date set: " + selectedDate);

          this.selectedDate = selectedDate;





      Richfaces related items in my web.xml:















                <display-name>RichFaces Filter</display-name>






                <servlet-name>Faces Servlet</servlet-name>






      When I change the date, this is what I see in my log:


      Getting mockup data

      Date set: Thu May 20 00:00:00 CEST 2010

      Getting mockup data


      I also tried using the following support tags, but then I only received the date that I selected *before*, besides the problem I described above...


      <a4j:support event="ondateselected" reRender="curDate" />

      <a4j:support event="ondateselect" reRender="curDate" />


      I've been searching for a long time now, so I really hope someone can help me with this.


      Kind regards and thanks in advance!