15

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

Community
  • 1
  • 1
mvg
  • 1,449
  • 3
  • 31
  • 58

2 Answers2

24

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.

Community
  • 1
  • 1
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • Yeah. I just compared my code with the one from the roseindia and found redisplay="true" is the main difference and corrected my source and it is now working correctly. – mvg Sep 23 '10 at 12:05
4

Update:

I Apologize :

The only thing needed to add is redisplay="true" as password is not diplayed for security reason


jmj
  • 225,392
  • 41
  • 383
  • 426
  • Thanks for the quick solution. I will work with it and get back to you. – mvg Sep 23 '10 at 07:49
  • Thanks for the link. Though this is not the exact solution, I want, I managed to solve this by adding redisplay="true" in . That site used this attribute to save the password. Thanks again! – mvg Sep 23 '10 at 09:40
  • @org, sorry, but I must do this: @mvg: I have to warn you, roseindia.net is a [terrible source](http://balusc.blogspot.com/2008/06/what-is-it-with-roseindia.html). Please ignore this site as long as you're new to JSF. It in general only teaches bad practices. – BalusC Sep 23 '10 at 11:42
  • @BalusC Thanks for the info. Finally for this question the solution concluded is redisplay="true" from there for now, I will take care next time .Thanks – jmj Sep 23 '10 at 11:58
  • @Balusc Thanks for the info. Horrible though. Thanks for sharing. – mvg Sep 23 '10 at 12:02