Java Reference
In-Depth Information
required="true"/></td>
</tr>
</table>
<p>
<h:commandButton id="loginButton"
value="#{cc.attrs.loginButtonText}"
action="#{cc.attrs.loginAction}"/>
</p>
</h:form>
...
</composite:implementation>
The Using Page
The using page in this example application, web/index.xhtml , is an XHTML file that
invokes the login composite component file along with the managed bean. It validates the
user's input.
Click here to view code image
<div id="compositecomponent">
<ez:LoginPanel myLoginBean="#{myLoginBean}"
loginAction="#{myLoginBean.login}">
<f:validateLength maximum="10" minimum="4" for="vals" />
<f:validateRegex pattern="((?=.*\d)(?=.*[a-z])(?=.*[A-
Z]).{4,10})"
for="passwordVal"/>
</ez:LoginPanel>
</div>
The f:validateLength tag requires the user name to have from 4 to 10 characters.
The f:validateRegex tag requires the password to have from 4 to 10 characters and
to contain at least one digit, one lowercase letter, and one uppercase letter.
The Managed Bean
The managed bean, src/java/compositecomponentlogin/MyLo-
ginBean.java , defines a method called login , which retrieves the values of the user
name and password.
Click here to view code image
@ManagedBean
@RequestScoped
public class MyLoginBean {
Search WWH ::




Custom Search