<h: inputSecret> automatically becomes empty even if I store the value in the reverse bean for it

automatically becomes empty even if I save the value in the reverse bean for it. I already set the password value in the inputecret variable in the reverse bean in jsf2, and the input secret will be empty.

+5
source share
2 answers

This is indeed the default behavior <h:inputSecret>due to security concerns. You can get the value to redisplay by setting the attribute redisplayvalue true.

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

See also its documentation for the declaration description document (my attention)

Behavior coding

clientId "name". "", , " " - "" . "styleClass", "class".

+9

xhtml:

<h:form>
    <h:inputSecret value="#{login.password}" />
</h:form>

bean:

@Component //Spring component
public class Login{
    private String password;
    public Login(){
       password="12341fsf"; //any value you want to set
    }
}

,

+1

All Articles