3 Replies Latest reply on Jun 21, 2013 6:23 PM by bleathem

    Issue with dependent resource loading in dynamically created components in Richfces4

    piyush.mnnit

      Hello Guys,

       

      We are migrating our application from Richfaces 3.3 to Richfaces 4.


      I've hit a bit of a snag. RichFaces 4 appears to 'inject' CSS/JS resources by 'expanding' <h:head /> based on what components it sees are on the Facelets page? For example, if I put a <rich:calendar /> on my page, I see a...

       

           <link type="text/css" rel="stylesheet" href="/rfRes/calendar.ecss.jsf?db=eAHL6rC8BQAEkAIG&amp;ln=org.richfaces" />

       

      ...appear in my HTML output. This appears to be a new approach compared to 3.3.3.Final's org.ajax4jsf.Filter?

       

      However if I try creating the UICalendar dynamically (programmatically) such that there is no <rich: calendar/> in my static Facelets page originally (it is added at runtime), then no JS line gets injected. Presumably because the <h:head /> has already been processed by the time I create the UIComponent?

       

      Please find code below which I am using for creating calendar as per solution mentioned in https://community.jboss.org/message/601807, but even that is not working

       

      ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);

      Application app = factory.getApplication();

      FacesContext ctx = FacesContext.getCurrentInstance();

      UICalendar calendar = (UICalendar)app.createComponent(ctx, UICalendar.COMPONENT_TYPE, "org.richfaces.CalendarRenderer");

       

       

      Please help me with alternative/solution asap.

       

      Regards,

       

      Piyush