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="#{passwordController.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.
When feedback
is enabled, it's also possible to set the prompt label and the strength label with the promptLabel
, weakLabel
, goodLabel
, and strongLabel
attributes. This will help to localize the password
input component according to need
.
<p:password value="#{passwordController.password}" promptLabel="#{msg['password.promptLabel']}" weakLabel="#{msg['password.weakLabel']}" goodLabel="#{msg['password.goodLabel']}" strongLabel...