1 Reply Latest reply on May 4, 2008 6:28 AM by Andy Gibson

    Converting Richfaces Calendar Date instance to a custom String

    infinity2heaven Novice

      <rich:calendar id="date" datePattern="MMM-yyyy"                   value="#{foo.date}"/>



      the entity


      @Length (max=8)
      private String date;
      
      public String getDate() { .. }
      
      public void setDate(String date) {
         this.date timePeriod = MyDateUtils.formatDate(date);
      }



      formateDate, simply converts the long Date/Timestamp/Timezone string into a 'MMM-YYYY' string. (size-8).


      The problem is, when I submit my form, hibernate validator gets invoked even before the setter is called. As Richfaces, converts the Date object into a Date/Timestamp/Timezone string, I get an error as the length is gt 8.


      How can I convert the pattern that the richfaces tag submits or how do I convert the pattern before hib validators are called?