In the previous article we spoke about annoying issue of the Mojarra 2.0.0 PR when the empty attributes are rendered to the final html code. The issue was posted to the Mojarra project:

Now, it is fixed. Let's take a new version of Mojarra 2.0.0 . It is not a PR release, but the SNAPSHOT dated 01/27/08.

The SNAPSHOT has two more surprises.

First, we can use c:if to have a conditional insert now. We speak about it in the Part 2.

Second, there is no composite:insertChildren any more. This tag was replaced with composite:renderUsingPageChildren. It is more correct semantically, but requires some time to memorize.

Ok, this is code of the component that works:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns=""
    <composite:attribute name="style" required="false"/>
    <composite:attribute name="styleClass" required="false"/>
    <composite:attribute name="headerClass" required="false"/>
    <composite:attribute name="bodyClass" required="true"/>
    <h:outputStylesheet name="rich/css/panel.css" />
 <div class="rich-panel #{compositeComponent.attrs.styleClass}"
  <c:if test="#{! empty compositeComponent.facets.header}">
   <div class="rich-panel-header #{compositeComponent.attrs.headerClass}">
    <composite:insertFacet name="header"/>
  <div class="rich-panel-body #{compositeComponent.attrs.bodyClass}" > 
   <composite:renderUsingPageChildren />

This is a deployed example:

If you look at the result html code, you can see what no more empty attributes inserted.

04. Feb 2009, 09:08 CET | Link
Cloves Almeida | cjalmeida(AT)

Very nice. But a question/suggestion: the on* events seems way too verbose. Is it possible to set a default sink for attributes implementation? So the following code would be equivalent:

    <h:outputStylesheet name="rich/css/panel.css" />
 <div class="rich-panel">
  <composite:sink />

  <c:if test="#{! empty compositeComponent.facets.header}">
   <div class="rich-panel-header #{compositeComponent.attrs.headerClass}">
    <composite:insertFacet name="header"/>
  <div class="rich-panel-body #{compositeComponent.attrs.bodyClass}" > 
   <composite:renderUsingPageChildren />

It would simply map component's similar named attributes into the parent tag. Exception for the 'styleClass' which would be mapped to the class attribute.

04. Feb 2009, 20:07 CET | Link

I like this idea - of course, it wouldn't work for non-JSF-components like <div /> but it could work for <my:div />. I doubt there is itme to get this into JSF2, but I wonder if it could be done as an extension?

05. Feb 2009, 00:19 CET | Link
Sergey Smirnov

Verbose is a point I spoke in the Part 4. I also told with Ryan and Ed from Sun. Ryan confirmed that no shortcut is implemented. Ed said that my case felt into 20% of 80/20 rules.

See log of JSF IRC , starting 19:00.

30. Aug 2014, 03:52 CET | Link

Best friend successive good years, Gucci Shoes Factory, winter spent in Sanya, Monster Beats Outlet, so winter home, seems to be nowhere in sight, North Jackets Outlet, both a little rusty, Nike Air Max Shoes, but also very cordial, Burberry Outlet Online, forward to tonight, feather-like snow, MCM Bags Outlet, drifts underground, Coach Black Friday, looking at that the floc, Louis Vuitton Outlet, fly like snow Ling, Michael Kors Outlet Online, eloquent, Polo Outlet Online, flying in the sky, Cheap Canada Goose, limp walk downs, strange things, Marc Jacobs Outlet Online, I float thinking lianpian, North Outlet Online, poetic heart wenqing, not help surging surging, Coach Factory Outlet, so I borrowed the winter, Ralph Lauren UK, snows research ink, Longchamp Sacs Sortie, into the mind of inactivity, Michael Kors Outlet, the white snow everywhere, Monster Beats By Dre, wrapped in some different, Ralph Lauren Outlet, kind of scenery, Oakley Sunglaases Outlet, wherever the wind in the faces, of the people, Michael Kors Bags Outlet, who are very Huddled, could not help.