p:password 不会重新显示预填充的模型值 [英] p:password doesn't redisplay prefilled model value

查看:33
本文介绍了p:password 不会重新显示预填充的模型值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的托管 bean:

i have my managed bean like this :

@ManagedBean 
@SessionScoped
public class utilisateur implements Serializable {

    private String login ="yous" ;
    private String password ="yous";
    ...
    ...

}

还有我的 login.xhtml

and my login.xhtml

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

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

所以在这种配置下,密码必须在默认情况下显示为 **** (yous) in p:password 但它显示为空.

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

推荐答案

这是出于安全原因的默认行为.如果您需要在模型提交或预设密码时显示密码,则需要将 redisplay 属性显式设置为 true.

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

另请参阅<p:密码> VDL 文档,它是最后一个属性.

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

redisplay 布尔标志,指示是否应在表单中呈现先前输入的密码.默认为 false.

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

这篇关于p:password 不会重新显示预填充的模型值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆