5 Replies Latest reply on Oct 4, 2011 2:22 AM by ozorin

    Re: Problem adding UICalendar programmatically

    ozorin

      Hi Nick,

       

      I've corrected my bean as you said, but richfaces js library not adding to generate html page. What else could be the problem?

      /// using Richfaces 4.0.0 Final (tried 4.1.0 M2) & Mojarra 2.1.2 ///

       

      XHTML page:

      <?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: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">

          <h:head>

              <title>Auto</title>

          </h:head>

          <h:body>

              <h:form id="formC" binding="#{bean.formC}"  />

          </h:body>

      </html>

      Method from Bean:

      public HtmlForm getFormC() {

              FacesContext facesContext = FacesContext.getCurrentInstance();

              Application application = facesContext.getApplication();

              formC = (HtmlForm) application

                      .createComponent(HtmlForm.COMPONENT_TYPE);

              UICalendar rrCalendar = (UICalendar) application.createComponent(

                      facesContext, UICalendar.COMPONENT_TYPE,

                      "org.richfaces.renderkit.html.CalenderRenderer");

              rrCalendar.setDisabled(false);

              rrCalendar.setPopup(true);

              rrCalendar.setBoundaryDatesMode("scroll");

              rrCalendar.setValueExpression("value",

                      createValueExpression("#{bean.dayDate}", String.class));

              formC.getChildren().add(rrCalendar);

          return formC;

      }

       

      public void setFormC(HtmlForm formC) {

          this.formC = formC;

      }

       

      P.S. When adding <rich:calendar> tag in xhtml page, all richfaces js library add to genereted html page.