[com.opensymphony.xwork2.ognl.OgnlValueStack]Error setting expression 'user.companyName' with value '[Ljava.lang.String;@57a41eae'
ognl.OgnlException: companyName [java.lang.IllegalArgumentException: argument type mismatch]
at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:103)
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2315)
at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301)
at ognl.ASTChain.setValueBody(ASTChain.java:227)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301)
at ognl.Ognl.setValue(Ognl.java:737)
at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:217)
at com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:186)
at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:173)
at com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:151)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:317)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:228)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
一运行,就报这个错,说什么类型不匹配,但是我的实体类和页面的都是String型,我不知道到底是哪里类型不对。如果页面把值写成死的,就不报错,好坑啊,求大神帮忙解决!
这是我的实体类,相应的get,set方法都有,除了companyname属性不对,loginname,telephone,username几个属性也报同样的错。
private Integer id;
private String username;
private String loginname;
private String password;
private String telephone;
private String address;
private String companyname;
private String post;
private Integer status;
private String email;
private Set<UserRole> userRoles = new HashSet<UserRole>(0);这是我的action类,报错的几个属性都为空。。
public void save(){
Json j=new Json();
try{

userService.add(user);


j.setSuccess(true);
j.setMsg("添加用户成功");
}catch(Exception e){
logger.error(ExceptionUtil.getExceptionMessage(e));
j.setSuccess(false);
j.setMsg("添加用户失败,请重试或与管理员联系");
}
super.writeJson(j);
}