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

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

问题描述

我的托管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}"  />  

因此,使用此配置时,默认情况下必须像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:password> VDL文档,它是最后一个属性之前的那个.

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

redisplay布尔标志,指示是否应以表格形式呈现先前输入的密码. 默认为假.

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

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

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