我想通过ajax提交以下表单。但是当我提交它时,它没有获取/设置char类型属性的值。但当我将托管bean类型中的密码属性更改为String时,它可以工作。这是为什么?
表格
<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>
托管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;
}
}
没有显示控制台日志错误。当数据类型密码为String时,控制台会显示getuser
setuser
getpass
setpass
。当数据类型为char时,它会显示getuser
getpass
为什么会这样? char[]
无效?
答案 0 :(得分:0)
请仔细阅读明确提及的link
有关更多详细信息,您可以查看与library(devtools);install_github('vqv/ggbiplot')
library(ggbiplot)
pca = prcomp(iris[,1:4])
ggbiplot(pca,groups = iris$Species,ellipse = T,ellipse.prob = .95)
Security: is there a way to use a straight reference to char[] instead of a String?