异常提示为:
javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:469)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:818)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:194)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.linhao.web.filter.SetCodeFilter.doFilter(SetCodeFilter.java:39)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
java.lang.IllegalArgumentException: array element type mismatch
java.lang.reflect.Array.set(Native Method)
org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:464)
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:986)
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:467)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:818)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:194)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.linhao.web.filter.SetCodeFilter.doFilter(SetCodeFilter.java:39)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
//BaseForm 继承了 ActionForm了 下面是formbean:
public class PrivilegeGroupForm extends BaseForm {
private String name;
private SystemPrivilegePK[] privileges;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public SystemPrivilegePK[] getPrivileges() {
return privileges;
}
public void setPrivileges(SystemPrivilegePK[] privileges) {
System.out.println("before set privileges....");
this.privileges = privileges;
System.out.println("after set privileges....");
}
}
下面是jsp表单:
<html:form action="/control/privilegegroup/manage" method="post" onsubmit="return checkfm(this)">
<input type="hidden" name="method" value="add">
<table width="90%" border="0" cellspacing="2" cellpadding="3" align="center">
<tr bgcolor="6f8ac4"><td colspan="2" > <font color="#FFFFFF">添加权限组:</font></td>
</tr>
<tr bgcolor="f5f5f5">
<td width="22%" > <div align="right">权限组名称:</div></td>
<td width="78%"> <html:text property="name" size="20" maxlength="20"/>
<font color="#FF0000">*</font></td>
</tr>
<tr bgcolor="f5f5f5">
<td width="22%" > <div align="right">选择权限:</div></td>
<td width="78%"> <c:forEach items="${privileges}" var="privilege" varStatus="statu">