becomes empty automatically even if i keep value in the back bean for it. I have already set the value for password in inputsecret variable in the back bean in jsf2 than also the input secret is being shown empty.
            Asked
            
        
        
            Active
            
        
            Viewed 4,500 times
        
    2 Answers
11
            This is indeed the default behaviour of <h:inputSecret> due to security reasons. You can get the value to redisplay anyway by setting the redisplay attribute to true.
<h:inputSecret value="#{bean.password}" redisplay="true" />
See also its view declaration language documentation (emphasis mine)
Encode Behavior
Render the clientId of the component as the value of the "name" attribute. Render the current value of the component as the value of the "value" attribute, if and only if the "redisplay" component attribute is the string "true". If the "styleClass" attribute is specified, render its value as the value of the "class" attribute.
- 
                    Thanks for the reply, i was missing that tag – deepmoteria Dec 15 '11 at 06:07
 - 
                    1You're welcome. It's by the way an attribute, not a tag :) – BalusC Dec 15 '11 at 06:10
 
1
            
            
        This is part of xhtml page:
<h:form>
    <h:inputSecret value="#{login.password}" />
</h:form>
This is backing bean:
@Component //Spring component
public class Login{
    private String password;
    public Login(){
       password="12341fsf"; //any value you want to set
    }
}
I tested this code it works fine
        olyanren
        
- 1,448
 - 4
 - 24
 - 42
 
- 
                    Thanks for your reply but i am using the jsf managed bean, and it is not the case with it. Thanks again for reply – deepmoteria Dec 15 '11 at 06:07