javax.servlet.ServletException: BeanUtils.populate

javax.servlet.ServletException:BeanUtils.populateorg.apache.struts.util.RequestUtils.... 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.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

root cause

java.lang.IllegalArgumentException: Cannot invoke com.cn.struts.form.UserForm.setUser - 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)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
这是我的UserAction的方法
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UserForm userForm = (UserForm) form;// TODO Auto-generated method stub
boolean login=this.getKUserBiz().login(userForm);
if(login){
request.getSession().setAttribute("User", userForm.getUser());
response.sendRedirect("house.do?param=toList"); }
return mapping.findForward("fail");
}

Biz层
public boolean login(UserForm form) {
KUsers user=form.getUser();
KUsers u=this.getKUserDao().findById(user.getKUsersId());
if(null!=u && null!=user.getKUsersPassword()&& user.getKUsersPassword().equals(u.getKUsersPassword())){
form.setUser(u);return true;}else{return false;}}
UserFrom里的代码
private KUsers user=null;
public UserForm()
{this.user=new KUsers();}
public KUsers getUser() {
return user;}
public void setUser(KUsers user) {
this.user = user;}
展开
 我来答
渝宝间2847
2011-04-21 · TA获得超过134个赞
知道答主
回答量:70
采纳率:0%
帮助的人:0
展开全部
在复制的时候类型不一致导致的错误。
追问
我也知道是类型不致的错误,但是我找了半天了都没有找到,我补充了一下问题,请你帮我看一看
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式