Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

java - Setting the value for jsf InputSecret during page load from the managed bean

I am creating a database setting jsf page which shows the value from the properties file during the page load. The users then updates the page and press submit and the value get updated in the properties file.

I followed this solution provided by Balusc

Invoke JSF managed bean action on page load

and set the value in the constructor of the backing bean.

  public DbSettingsBean()
  {        
    this.setUserName(helper.getValueForProperty("user_name"));
    this.setPassword(helper.getValueForProperty("password"));
  }

While I managed to show the user name from the properties file during page load. I am unable to show the value of inputsecret for password during the page load. It remains blank.

Is there any other way to show password during page load?

I am using JSF RI 1.2 and Richfaces 3.3.2

Thanks in advance

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The <h:inputSecret> indeed doesn't redisplay passwords by default due to security reasons. You can however turn it on by setting redisplay="true".

<h:inputSecret value="#{bean.password}" redisplay="true" />

See also its TLD document:

redisplay

Flag indicating that any existing value in this field should be rendered when the form is created. Because this is a potential security risk, password values are not displayed by default.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...