P: password does not display the preset value of the model

I have my managed bean as follows:

@ManagedBean @SessionScoped public class utilisateur implements Serializable { private String login ="yous" ; private String password ="yous"; ... ... } 

and my login.xhtml

 <h:outputText value="login: " /> <p:inputText value="#{utilisateur.login}" /> <h:outputText value="password: " /> <p:password value="#{utilisateur.password}" /> 

therefore, with this configuration, the password should be specified by default, as **** (yous) in p:password , but it shows empty.

+6
source share
1 answer

This is the default behavior for security reasons. You need to explicitly set the redisplay attribute to true if you need to display the password from the model whenever it has been sent or set.

 <p:password value="#{utilisateur.password}" redisplay="true" /> 

See also the <p:password> VDL documentation , this is the one that came before the last attribute.

redisplay boolean flag indicating whether the previously entered password in the form should be displayed. The default value is false.

+14
source

Source: https://habr.com/ru/post/917192/


All Articles