4 Replies Latest reply on Oct 14, 2010 8:48 PM by Nick Belaevski

    Problem with rich:calendar component children

    Romain Taz Newbie

      Hi all,

      I just migrated to RichFaces 3.1.2.
      I wanted to use the new Calendar component in my application.
      However, I have a problem with it.

      I have developed a client side validation component that modifies its parent component to set the adequate Javascript call. However, it does not create any HTML code.
      On the JSF page, I have something like that:

      <rich:calendar ...>
      <my:clientValidation type="required"/>
      </rich:calendar>

      The problem is that I get a NullPointerException when I do that:

      java.lang.NullPointerException
      at org.richfaces.renderkit.TemplateEncoderRendererBase.writeScriptBody(TemplateEncoderRendererBase.java:68)
      at org.richfaces.renderkit.TemplateEncoderRendererBase.writeScriptBody(TemplateEncoderRendererBase.java:134)
      at org.richfaces.renderkit.CalendarRendererBase.writeMarkupScriptBody(CalendarRendererBase.java:155)
      at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:277)
      ...

      After some searches in the RichFaces source code, I found that if the RichFaces calendar has children, it run this code:

      if (component.getChildCount() != 0) {
      writer.writeText(convertToString(",dayListMarkup:"), null);
      writeMarkupScriptBody(context, component, true);
      }

      How can I add my component within the Calendar without having this error?