0 Replies Latest reply on Jan 8, 2008 3:47 PM by marto

    Error converting dates

    marto

      Hi all,

      I'm triying to create an input to process date and time values at runtime. I tried to do this with a Calendar and I got the same error that now i'm getting with a normal input text plus a converter.

      The component is inside an a4j:form and a4j:region and it is submitted by clicking on a a4j:commandButton with a actionListener set.

      The error apears linked to the control, so it is produced when its value is processed, and this is the text: "rm2:indataArribada: An error occurred when processing your submitted information." And no information is showed in the log of the app server.

      This error only happens when the form is submitted, but the date is loaded well and showed in the form.

      The code to create the component is next:

      FacesContext ctx = FacesContext.getCurrentInstance();
      ExpressionFactory expressionFactory = ctx.getApplication()
       .getExpressionFactory();
      ELContext elContext = ctx.getELContext();
      
      ValueExpression value = expressionFactory.createValueExpression(elContext, #{bean.dateField},
       java.sql.Date.class);
      
      HtmlInputText input = new HtmlInputText();
      DateTimeConverter conv = new DateTimeConverter();
      conv.setType("both");
      conv.setLocale(new Locale("es_ES"));
      conv.setPattern("dd/MM/yyyy hh:mm");
      input.setConverter(conv);
      input.setValueExpression("value", value);
      


      thanks a lot,

      Marto