Enhanced password input

The password component is an extended version of the JSF <h:inputSecret> component, which also provides a strength indicator and the match mode.

How to do it…

The basic declaration for the component will provide no feedback on the input password and will just render a simple input component:

<p:password value="#{passwordBean.password}" />

To enable the strength indicator, the feedback attribute should be set to true. By default, the indicator will be rendered right next to the component when it is hovered:

How to do it…

When feedback is enabled, it's also possible to set the prompt label and the strength label with the promptLabel, weakLabel ...

Get PrimeFaces Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.