1 Reply Latest reply on Nov 9, 2014 4:10 PM by Tom Hain

    Date Items in rich:pickList not converted

    Tom Hain Newbie

      I make use of the RichFaces component rich:pickList to provide a list of Date objects which can be selected

      When the data gets validated the JSF page shows a validation error: "Validation Error: Value is not valid". I know, the Date Object is somehow not converted. But I don't know why? First I tried setting the attribute dateConverter:


      This didn't work. Afterwards, I added the following statement:

      <f:convertDateTime pattern="MM/dd/yyyy" />

      Didn't solve the issue either.

      Btw: What is the difference of both ?


      Please find below the whole source code:



      !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" 
         <ui:composition template="/templates/template.xhtml">
              <ui:define name="body">
                   <h:form prependId="false">
                        <rich:pickList id = "datePL" 
                             sourceCaption="All Dates" 
                             targetCaption="New Dates">
                                  <f:selectItems value="#{richBean.listOfDates}"
                                       var="_item" itemValue="#{_item}" itemLabel="#{_item}" />
                                       <f:convertDateTime pattern="MM/dd/yyyy" />
                        <a4j:commandButton action="#{richBean.printListOfDates()}" value="Print"/>
                             <rich:notifyMessages stayTime="2000" nonblocking="true" />


      Managed Bean:


      import java.io.Serializable;
      import java.util.ArrayList;
      import java.util.Calendar;
      import java.util.Date;
      import java.util.Iterator;
      import java.util.List;
      import javax.annotation.PostConstruct;
      import javax.faces.bean.SessionScoped;
      import javax.inject.Named;
      public class RichBean implements Serializable {
         private static final long serialVersionUID = -2403138958014741653L;
         private List<Date> listOfDates;
         private List<Date> listOfNewDates;
         public void init() {
        setListOfDates(new ArrayList<Date>());
         Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DATE, 1);
        cal.add(Calendar.DATE, 2);
        * @return the listOfDates
         public List<Date> getListOfDates() {
         return listOfDates;
        * @return the listOfNewDates
         public List<Date> getListOfNewDates() {
         return listOfNewDates;
        * @param listOfNewDates the listOfNewDates to set
         public void setListOfNewDates(List<Date> listOfNewDates) {
         this.listOfNewDates = listOfNewDates;
         public void printListOfDates() {
         for (Iterator<Date> it = listOfNewDates.iterator(); it.hasNext();) {
         System.out.println("Neues Datum = " + it.toString());
        * @param listOfDates the listOfDates to set
         public void setListOfDates(List<Date> listOfDates) {
         this.listOfDates = listOfDates;