When this blog is writing, JSF 2.0 specification reached the Public Review status. Everybody can visit the JSR-314 EG page and download his own copy of it. Comparing to JSF 1.2 when the implementation appeared about one year after the specification is done, Sun is developing the reference implementation, also known as Project Mojarra, at the time with writing the specification. Thus, you can try new features of JSF 2.0 right away downloading the Mojarra 2.0.0 PR release from the project home page: .

JSF 2.0 has some cool innovation features. One of them is PDL (Page Declaration Language). PDL inherits its core functionality from two well known JSF project - Facelets and JSFTemplates. Among all other features, it allows to create new JSF components in declarative manner, without creating a bunch of java classes like it was in the previous JSF versions. In this blog we will test-drive this feature and show the top features of PDL.

Binary Mojarra distribution already contains ezcomp00 and ezcomp01 applications that show the basic of the PDL. We are not going to repeat them, but will create something different. RichFaces has a rich:panel, pretty simple, but useful JSF component. It represents the rectangle with a body and an optional header defined by a facet. The look-n-feel of the rich:panel is defined with some set of css rules. Some of those rules refer to the parameters taken from the skin parameters. I.e. css has static and dynamically generated rules. If header presents, it is filled with background gradient generated by java class that also uses the skin parameters as base colors for generated gradient. The working example of the rich-panel you can see at the main richfaces demo at:

Actually, RichFaces has a CDK (Component Development Kit) that is used for creating all 100+ RichFaces component. CDK is a maven based tool that generates components based on the meta-data, java classes and jspx templates that define a component layout. The rich:panel was exactly the component that we use to test-drive the first versions of CDK. Hence, now we just need to follow the same path, but using a new standard of JSF 2.0 - Page Declaration Language.

Note: JSF 2.0 PDL and CDK JSPX are not very well comparable things. CDK JSPX templates makes sense only for design time. They are compiled into the java classes and the result library does not contain the templates and some sort of interpretation processor. At least, the result code works faster.

The structure of the rich:panel is pretty simple. It has an outer div, body div and header div optionally.

<div class="rich-panel">
    <div class="rich-panel-header">This is a panel header</div>
    <div class="rich-panel-body">The is the panel body</div>

Let's see what we can do using JSF 2.0 PDL. How to create a simple component like the one shown in the ezcompXX demo and described several times in the blogs and introduction articles. I like the JSF 2.0 PREVIEW by Cagatay Civici presentation. It is short and overview the key feature is JSF 2.0. The page where component is used looks like:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns=""
<f:view contentType="text/html"/>

    <title>Panel Test</title>

   <f:facet name="header">
    <h:outputText value="This is a panel header"/>
   <h:outputText value="The is the panel body"/>



We use rich: namespace which is defined at the top of the page as xmlns:rich=" In our case, means we have a folder with the name rich that is located in the {webtoot}/resources/ folder. {webtoot}/resources/rich/ folder contains the panel.xhtml file where the our panel component is located. This is a content of the panel.xhtml file:

<!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="false"/>
    <h:outputStylesheet name="rich/css/panel.css" />
 <div class="rich-panel #{compositeComponent.attrs.styleClass}"
  <div class="rich-panel-header #{compositeComponent.attrs.headerClass}">
   <composite:insertFacet name="header"/>
  <div class="rich-panel-body #{compositeComponent.attrs.bodyClass}" > 
   <composite:insertChildren />

Our component is represented with two tags: composite:interface and composite:implementation. The interface has a declaration for attribute set. For the sake of simplicity, we avoid all other attributes, but add only the ones that represent the component styling. The implementation tag contains the layout of the component. The context of the header is inserted with:

<composite:insertFacet name="header"/>

The panel can contains the number of other component insert. We just use the composite:insertChildren to point to the place where the children will be inserted to. Mojarra 2.0 binary distribution has a pdldocs archive. It contains the documentation to all PDL related tags.

The class attributes of the div tags reference the static name of the default component classes and to the user defined classes wired using EL expressions. The classic h: library has some new components including h:outputStylesheet. We use it to reference the static CSS file with default panel CSS rules. Note, that the used path is relative. However, the root of this relative path is located not where panel.xhtml is located, but where the {webtoot}/resources/ folder is. Thus, {webtoot}/resources/rich/css/panel.css contains:

  border-width: 1px;
 border-style: solid;
 padding : 1px;
 padding : 2px;
    border-width: 1px;
    border-style: solid;
 padding : 10px;

At this moment we are done with basic of the panel. Let's see how to reach the rest of the rich:panel features. To be continued....

17. Jan 2009, 01:37 CET | Link

Thanks Sergey, it was very easy to understand what happens under the hood with rich:panel. Looking forward to see how to implement it in jsf 2.0

13. Jul 2009, 04:36 CET | Link
webtoot? I think that should be webroot.
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.

04. Oct 2014, 13:11 CET | Link

Get your home available on the industry, sold and move on at lightning speed with the help of the above tips and a top notch broker. Sell your home fast