private String roleName;
private String roleNote;
private Set<Authority> authorities = new HashSet<Authority>(0);
private Set<User> users = new HashSet<User>(0);role_update.jsp
<form:checkboxes items="${allAuthoritys}" path="authorities" itemLabel="name" itemValue="aid"/>
现在一提交报错信息如下:
Field error in object 'role' on field 'authorities': rejected value [1,2,3,7,8]; codes [typeMismatch.role.authorities,typeMismatch.authorities,typeMismatch.java.util.Set,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [role.authorities,authorities]; arguments []; default message [authorities]]; default message [Failed to convert property value of type 'java.lang.String[]' to required type 'java.util.Set' for property 'authorities'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.zxw.pojo.Authority] for property 'authorities[0]': no matching editors or conversion strategy found]
我的Action中的update方法如下:
@RequestMapping(value = "/pages/back/role_update")
public ModelAndView update(Role role) throws Exception {
ModelAndView mv = new ModelAndView("/jsp/forward.jsp");
return mv;
}
springmvcJava
private String roleNote;
private Set<Authority> authorities = new HashSet<Authority>(0);
private Set<User> users = new HashSet<User>(0);role_update.jsp
<form:checkboxes items="${allAuthoritys}" path="authorities" itemLabel="name" itemValue="aid"/>
现在一提交报错信息如下:
Field error in object 'role' on field 'authorities': rejected value [1,2,3,7,8]; codes [typeMismatch.role.authorities,typeMismatch.authorities,typeMismatch.java.util.Set,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [role.authorities,authorities]; arguments []; default message [authorities]]; default message [Failed to convert property value of type 'java.lang.String[]' to required type 'java.util.Set' for property 'authorities'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.zxw.pojo.Authority] for property 'authorities[0]': no matching editors or conversion strategy found]
我的Action中的update方法如下:
@RequestMapping(value = "/pages/back/role_update")
public ModelAndView update(Role role) throws Exception {
ModelAndView mv = new ModelAndView("/jsp/forward.jsp");
return mv;
}
springmvcJava
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货