0 Replies Latest reply on Nov 10, 2011 10:34 PM by jackrobert1985

    rich:calandar issue

    jackrobert1985

      Hi,

       

            I use rich:calandar component for select date.

           Normaly click this component, then calandar popup appear, then select the date.

       

      My problem is , Some times i can't click the component, It means calandar popup not appear.

                               If i clear my browser history, and re deploy my application, then it will works.                        

                               I don't know how to resolve this problem.

       

      In my application, use  JSF 1.2 + Richfaces and Apache Tomcat 6.0.29.

       

       

      calanderDemo.jsp

       

      <%@page contentType="text/html" pageEncoding="UTF-8"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd">
      
      <f:view>
      
          <html>
              <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">                      
              </head>
              <body>
                  <h:form id="calendarform" binding="#{CalendarDemo.initForm}"> 
                      <rich:panel id="calendarPanel">
      
                          <a4j:outputPanel id="calendarOutputPanel">
      
                              <rich:calendar id="birthDate"
                                             value="#{CalendarDemo.testDate}"
                                             datePattern="dd/MM/yyyy"
                                             showApplyButton="false"/>
      
                              <a4j:commandButton value="Show Selected Date" action="#{CalendarDemo.showSelectedDate}"
                                                 reRender="calendarOutputPanel"/>
      
                              <h:outputText value="Selected Date is : #{CalendarDemo.selectedDate}"/>
      
                          </a4j:outputPanel> 
                      </rich:panel> 
                  </h:form>
              </body>
          </html>
      </f:view>
      

       

      Then my managed bean class 'CalendarDemo.java'

       

       

      import java.util.Date;
      import javax.faces.component.html.HtmlForm;
      
      public class CalendarDemo
      {
      
          private HtmlForm initForm;
          private Date testDate;
          private String selectedDate;
      
          public String showSelectedDate()
          {
              if (testDate != null)
              {
                  selectedDate = testDate.toString();
              }
              return "";
          }
      
          public HtmlForm getInitForm()
          {
              testDate = null;
              selectedDate = "";
              return initForm;
          }
      
          public void setInitForm(HtmlForm initForm){
              this.initForm = initForm;
          }
      
          public Date getTestDate(){
              return testDate;
          }
      
          public void setTestDate(Date testDate) {
              this.testDate = testDate;
          }
      
          public String getSelectedDate() {
              return selectedDate;
          }
      
          public void setSelectedDate(String selectedDate){
              this.selectedDate = selectedDate;
          }
      }
      

       

      Help me.

      Thanks for your effort.