PrimeFaces Password
It is an input field which takes hidden value from the user. The <p:password> component is used to create a password field in JSF application. It also provides feedback while entering the password. It has various attributes that are tabled below.
Password Attributes
Attribute |
Default value |
Type |
Description |
required |
false |
Boolean |
It is used to mark component as required. |
feedback |
false |
Boolean |
It enables strength indicator. |
inline |
false |
Boolean |
It displays feedback inline rather than using a popup. |
promptLabel |
Please enter a password |
String |
It is a label of prompt. |
weakLabel |
Weak |
Boolean |
It is used to set label of weak password. |
goodLabel |
good |
String |
It is used to set label of good password. |
strongLabel |
strong |
String |
It is used to set label of strong password. |
redisplay |
false |
Boolean |
It is used to display previous value. |
match |
null |
String |
It matches id of another password component to match value against. |
maxlength |
null |
Integer |
It is used to set maximum number of characters that may be entered in
this field.
|
placeholder |
null |
String |
It specifies a short hint. |
readonly |
false |
Boolean |
It is used to set component readonly. |
size |
null |
Integer |
Number of characters used to determine the width of the
input element.
|
style |
null |
String |
It is used to set inline CSS of the input element. |
tabindex |
null |
Integer |
It is used to set position of the input element in the tabbing order. |
title |
null |
String |
It is used to set advisory tooltip information. |
Example
Here, in the following example, we are implementing <p:password> component. This example contains the following files.
JSF File
// password.xhtml
ManagedBean
// Password.java
Output:
|