真正的快乐来源于创造
结果,进行页面数据验证的JS能准确无误的进行前段验证,但Action中没有收到请求,验证完毕提交表单后出现下面的异常,
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.servlet.ServletException: BeanUtils.populate org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) 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.heyang.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:35)
root cause
javax.servlet.ServletException: BeanUtils.populate org.apache.struts.util.RequestUtils.populate(RequestUtils.java:469) org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:50) org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:60) org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) 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.heyang.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:35)
java.lang.IllegalArgumentException: No bean specified org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751) org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937) 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.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:50) org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:60) org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) 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.heyang.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:35)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
发生这个错误的原因应该是使用工具类commons beanutil向ActionForm中的属性user输入数据时发生了错误,解决这个问题也很简单,在ActionForm内部将属性user实例化即可,代码如下:
Copyright @ 何杨 Powered by: .Text and ASP.NET Theme by: .NET Monster