I want to submit following form via ajax. But when I submit it, it not get/ set value to char typed property. but when I changed password property in managed bean type as String it works. Why is that?
Form
<h:form>
<h:inputText value="#{login.username}" id="username"
a:placeholder="Username" />
<br />
<h:inputSecret a:placeholder="Password" id="password"
value="#{login.password}" />
<br />
<h:inputText value="#{login.mvc}" />
<h:commandButton value="Submit" >
<f:ajax execute="@form" render="out" />
</h:commandButton>
<h:outputText id="out" />
</h:form>
Managed Bean
@ManagedBean
public class Login {
private String username;
private char[] password;
private String msg;
private String mvc;
@EJB
private LoginService ls;
public Login() {
}
public String getMvc() {
return mvc;
}
public void setMvc(String mvc) {
this.mvc = mvc;
}
public String getUsername() {
System.out.println("getuser");
return username;
}
public void setUsername(String username) {
System.out.println("setuser");
this.username = username;
}
public char[] getPassword() {
System.out.println("getpass");
return password;
}
public void setPassword(char[] password) {
System.out.println("setpass");
this.password = password;
}
public String getMsg() {
return msg;
}
}
No console log error shows and. when the data type password is String, console shows getuser
setuser
getpass
setpass
. When the data type is char it shows getuser
getpass
Why is that? char[]
is not valid?