6 Replies Latest reply on Oct 26, 2009 7:01 PM by granite2009

    Rich:Calendar any working sample?

    granite2009

      I have tried all the combinations for Rich:Calendar but no luck to pass the date to my backing bean. I have defined the backing field to be String, Date, HTMLCalendar without success. All other fields work OK.

      I would like to see a working sample of Rich:Calendar and the backing bean.

      This is my test code that is not working. Eventually I need this Calendar column to be in an ExtendedDataTable.

      <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
      <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
      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:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
      <jsp:directive.page contentType="text/html;charset=utf-8" />
      <f:view>
      <a4j:form>
      <rich:panel header="Test Date"
      style="width: 925px">
      <rich:calendar value="#{dateBean.testDate}"
      datePattern="MM/dd/yyyy" ajaxSingle="true"
      showApplyButton="false">
      </rich:calendar>
      </rich:panel>
      </a4j:form>
      </f:view>
      </jsp:root>

        • 1. Re: Rich:Calendar any working sample?
          nbelaevski

          Hi,

          Calendar is an input and doesn't do submits itself. Add a4j:commandLink that will do submits and try.

          • 2. Re: Rich:Calendar any working sample?
            granite2009

            Thanks. I got the single edit working.
            I still cannot make Calendar works inside a table. How do I add a submit every time a row is changed? All I needs is passing a date field to my bean. Any other method, component, work around is OK.

            Ling

            • 3. Re: Rich:Calendar any working sample?
              nbelaevski

              Ling,

              Add a4j:support to rich:calendar for this.

              • 4. Re: Rich:Calendar any working sample?
                granite2009

                a4j:support did not work. This is the error I got in Tomcat. Any other suggestions?

                Oct 26, 2009 10:14:09 AM com.sun.faces.lifecycle.RenderResponsePhase execute
                INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
                sourceId=j_id_jsp_485971654_1:table:0:sd[severity=(ERROR 2), summary=(j_id_jsp_485971654_1:table:0:sd: An error occurred when processing your submitted information.), detail=(j_id_jsp_485971654_1:table:0:sd: An error occurred when processing your submitted information.)]
                sourceId=j_id_jsp_485971654_1:table:0:ed[severity=(ERROR 2), summary=(j_id_jsp_485971654_1:table:0:ed: An error occurred when processing your submitted information.), detail=(j_id_jsp_485971654_1:table:0:ed: An error occurred when processing your submitted information.)]

                • 5. Re: Rich:Calendar any working sample?
                  nbelaevski

                  You should fix these messages first.

                  • 6. Re: Rich:Calendar any working sample?
                    granite2009

                    I kind of fixed this. It is a JPA issue. JPA only allow java.sql.Date but the Calendar only allow java.util.Date. I found that I need to add @Temporal to my Entity in order to make the type conversion work.
                    The only strange think is I cannot see my date value under debug using Eclipse. However, the value magically shows up in the Oracle DB. I am not complaining any more as long as it works before the scene.