lc32781971
Amacoder
2011-07-02 18:32

java.lang.IllegalArgumentException: argument type mismatch

  • struts

在地址栏传值就会出现这个异常了。
Action代码:
public ActionForward list(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String parentIdStr = request.getParameter("parentId");
Collection departmentList = null;
if(parentIdStr==null){
departmentList = (List) departmentService.getTopLevel();//查询顶级部门
}else{ //查询子部门
long id = Long.valueOf(parentIdStr);
departmentList = departmentService.getChildrenLevel(id);
}
request.setAttribute("departmentList", departmentList);
System.out.println(departmentList.size());
return mapping.findForward("list");
}
在地址栏写http://localhost:8080/oa_01/DepartmentAction.do?method=list 这个是没问题的。
如果写http://localhost:8080/oa_01/DepartmentAction.do?method=list&parentId=1 就出现这个异常了。

异常消息
javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.oa.filter.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:31)
root cause

java.lang.IllegalArgumentException: argument type mismatch
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.oa.filter.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:31)

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换