0 Replies Latest reply on Nov 12, 2007 6:05 AM by Marco Barbi

    rich:calendar setValueExpression issue

    Marco Barbi Newbie

      Hi,

      I'm working with RichFaces 3.1.2GA and I cannot figure out how the HtmlCalendar class can work with the valueExpression attribute (as regular UIInput components do).

      I create the calendar in this way:

      HtmlCalendar calendar = new HtmlCalendar();
      calendar.setInputClass("dateFormatInput");
      calendar.setId(fieldId);
      String value = "#{companyProfile.testDate}";
      calendar.setValueExpression("value", facesContext.getApplication().getExpressionFactory()
       .createValueExpression(facesContext.getELContext(),
       value, String.class));
      
      calendar.setPopup(true);
      String format = "dd/MM/yyyy";
      calendar.setDatePattern(format);


      and the relevant backing-bean code is:

      private Date testDate;
      
       public Date getTestDate() {
       return testDate;
       }
      
       public void setTestDate(Date testDate) {
       this.testDate = testDate;
       }
      
       public String doLoad() {
       testDate = new Date(1234567L);
       }


      where doLoad initialises the bean content.

      The issue is that I always get the following excpetion:

      12-nov-2007 11.53.34 com.sun.facelets.FaceletViewHandler handleRenderException
      GRAVE: Error Rendering View[/pages/granted/companyProfile.jspx]
      javax.faces.convert.ConverterException: ** javax.faces.converter.DateTimeConverter.DATE **
       at javax.faces.convert.DateTimeConverter.getAsObject(DateTimeConverter.java:390)
       at org.richfaces.component.UICalendar.getAsDate(UICalendar.java:254)
       at org.richfaces.component.UICalendar.getCurrentDateOrDefault(UICalendar.java:230)
       at org.richfaces.renderkit.CalendarRendererBase.getCurrentDate(CalendarRendererBase.java:355)
       at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:225)
       at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:436)
       at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
       at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:279)
       at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
       at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:326)
       at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:321)
       at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
       at org.richfaces.renderkit.html.SimpleTogglePanelRenderer.encodeChildren(SimpleTogglePanelRenderer.java:185)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271)
       at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
       at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
       at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
       at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      


      Do I miss something?
      Thanks.
      Marco