问题描述
请各位帮帮忙,看看是错在哪里错误信息:HTTP Status 500 -type Exception reportmessagedescription The server encountered an internal error () that prevented it from fulfilling this request.exceptionjavax.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) com.hail.uss.encoding.EncodingActionServlet.process(EncodingActionServlet.java:11) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) root causejava.lang.IllegalArgumentException: Cannot invoke com.hail.uss.web.form.ManagerUserForm.setListId - argument type mismatch org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1778) org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759) org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648) org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677) org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022) 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: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) com.hail.uss.encoding.EncodingActionServlet.process(EncodingActionServlet.java:11) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs. managerUser.jsp <html:form action="/admin/managerUser"><c:foreach items="${requestScope['readAction.display.list']}" var="a"></c:foreach>用户名性别生日电话邮箱地址注册时间<input name="listId" type="checkbox" value="${a.id}"><c:out value="${a.username}"><c:out value="${a.sex}"><c:out value="${a.birthday}"><c:out value="${a.phone}"><c:out value="${a.email}"><c:out value="${a.address}"><c:out value="${a.regdate}"><input name="all" type="checkbox"><html:submit value="删除"></html:form> ManagerUserForm.javapublic class ManagerUserForm extends ActionForm {/* * Generated fields */private List<integer> listId;public List<integer> getListId() {return listId;}public void setListId(List<integer> listId) {this.listId = listId;}/** * Method validate * @param mapping * @param request * @return ActionErrors */public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {ActionErrors ae = new ActionErrors();return ae;}/** * Method reset * @param mapping * @param request */public void reset(ActionMapping mapping, HttpServletRequest request) {// TODO Auto-generated method stub}} ManagerUserAction.javapublic class ManagerUserAction extends Action {/* * Generated Methods */private AdminDao adminDao;public void setAdminDao(AdminDao adminDao) {this.adminDao = adminDao;}/** * Method execute * @param mapping * @param form * @param request * @param response * @return ActionForward */public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) {ManagerUserForm f = (ManagerUserForm) form;adminDao.deleteById(f.getListId());return null;}} AdminDaoImpl.java部分代码:(AdminDaoImpl extends HibernateDaoSupport implements AdminDao)public void deleteById(List<integer> listId){try{for(Integer i : listId){String queryString = "from User as u where u.id="+i;List<user> list=this.getHibernateTemplate().find(queryString);for(User u : list){this.getHibernateTemplate().delete(u);}}}catch(RuntimeException re){throw re;}}
解决方案
猜测是类型转化时的错误如: request中的请求转化到form中