p:password doesn't redisplay prefilled model value

£可爱£侵袭症+ 提交于 2019-12-01 15:25:24

问题


i have my managed bean like this :

@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}"  />  

so with this configuration the password must be shown by default like **** (yous) in p:password but it shows empty.


回答1:


This is the default behaviour 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's been submitted or preset.

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

See also the <p:password> VDL documentation, it's the one before last attribute.

redisplay Boolean flag indicating whether or not a previously entered password should be rendered in form. Default is false.



来源:https://stackoverflow.com/questions/10852520/ppassword-doesnt-redisplay-prefilled-model-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!