Java Reference
In-Depth Information
The source code for this application is in the tut-install /examples/web/compos-
itecomponentlogin/ directory.
The Composite Component File
The composite component file is an XHTML file, /web/resources/ezcomp/Lo-
ginPanel.xhtml . It has a composite:interface section that declares the labels
for the user name, password, and login button. It also declares a managed bean, which
defines properties for the user name and password.
Click here to view code image
<composite:interface>
<composite:attribute name="namePrompt" default="User Name: "/>
<composite:attribute name="passwordPrompt" default="Password:
"/>
<composite:attribute name="loginButtonText" default="Log In"/>
<composite:attribute name="loginAction"
method-signature="java.lang.String ac-
tion()"/>
<composite:attribute name="myLoginBean"/>
<composite:editableValueHolder name="vals" targets="form:name"/>
<composite:editableValueHolder name="passwordVal" target-
s="form:password"/>
</composite:interface>
The composite component implementation accepts input values for the user name and
password properties of the managed bean.
Click here to view code image
<composite:implementation>
<h:form id="form">
<table columns="2" role="presentation">
<tr>
<td><h:outputLabel for="name"
value="#{cc.attrs.namePrompt}"/></td>
<td><h:inputText id="name"
value="#{cc.attrs.myLoginBean.name}"
required="true"/></td>
</tr>
<tr>
<td><h:outputLabel for="password"
value="#{cc.attrs.passwordPrompt}"/></td>
<td><h:inputSecret id="password"
value="#{cc.attrs.myLoginBean.password}"
Search WWH ::




Custom Search