9 Replies Latest reply on Jun 18, 2013 1:42 PM by Brian Leathem

    RichFaces 4: how to create components dynamically (h:head injection)?

    Richard Kennard Novice

      Hi guys,


      Congratulations on the RichFaces 4 release!


      I've been receiving a bit of interest in adding RichFaces 4 support to Metawidget (it currently supports 3.3.3.Final). However 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?


      What is the recommend approach to use here?