Java Reference
In-Depth Information
Every JSF 2.0 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 any 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 which we can use to enter the
addresses. That way, if we have to enter several addresses in an application, we can
encapsulate the logic and/or display in our component. If later we need to change
the address entry (to support international addresses, for example), we only need
to change our component and all address entry forms in our application will be
updated automatically.
After "illing 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="managedBean" 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" value="#{cc.attrs.managedBean.
<h:outputLabel for="line2" value="Line 2"/>
<h:inputText id="line2" value="#{cc.attrs.managedBean.
<h:outputLabel for="city" value="City"/>
<h:inputText id="city" value="#{cc.attrs.managedBean.
Search WWH ::

Custom Search