日期:2014-05-18  浏览次数:20758 次

struts的一个小测试中的异常
孙卫琴老师编的《精通struts基于MVC的java.web设计与开发》的第二章那个helloapp应用。
将光盘中的相应文件copy到tomcat5.0的webapp下,测试完全成功。
然后用myeclipse5.0m2进行重新开发(代码大部分都是copy来的),发布后正常运行都能通过,但表单验证时出现异常(即没有在表单中输入姓名就提交表单),异常如下:
(PS:我的jdk是1.5的。struts是1.1的)
description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

org.apache.jasper.JasperException:   org.apache.struts.action.ActionMessage
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root   cause  

java.lang.ClassCastException:   org.apache.struts.action.ActionMessage
org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:215)
org.apache.jsp.hello_jsp._jspx_meth_html_errors_0(hello_jsp.java:155)
org.apache.jsp.hello_jsp._jspx_meth_html_html_0(hello_jsp.java:121)
org.apache.jsp.hello_jsp._jspService(hello_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)



------解决方案--------------------
代码贴出来看看
------解决方案--------------------
可能你的工程建的有点问题或者是环境问题,既然在tomcat目录下可以运行成功就可能是你eclipse的环境问题
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html