Java Reference
In-Depth Information
Every JSF 2 composite component contains two sections: an interface and an
The interface section must be enclosed inside a <cc:interface> tag. In the interface,
we define all attributes that our component will have. The implementation section
contains the markup that will be rendered when we use our composite component.
In our example, we will develop a simple component we can use to enter addresses.
That way, if we have to enter several addresses in an application, we can encapsulate
the logic and/or display part in our component. If later we need to change an
address entry (for example, to support international addresses), we only need
to change our component and all address entry forms in our application will be
updated automatically.
After filling in the blanks, our composite component now looks like this:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns=""
<!-- INTERFACE -->
<cc:attribute name="addrType"/>
<cc:attribute name="namedBean" required="true"/>
<h:panelGrid columns="2">
<f:facet name="header">
<h:outputText value="#{cc.attrs.addrType} Address"/>
<h:outputLabel for="line1" value="Line 1"/>
<h:inputText id="line1"
<h:outputLabel for="line2" value="Line 2"/>
Search WWH ::

Custom Search