拼写检查代码实现java 拼写检查的快捷键( 九 )


Not associating an ActionFormdescended class with an action can also lead to this error.
异常
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
可能原因
不是标识Struts actionServlet的标记就是映射.do扩展名的标记或者两者都没有在web.xml中声明 。
在strutsconfig.xml中的打字或者拼写错误也可导致这个异常的发生 。例如缺少一个标记的关闭符号/ 。最好使用struts console工具检查一下 。
另外,loadonstartup必须在web.xml中声明,这要么是一个空标记,要么指定一个数值,这个数值用来表servlet运行的优先级 , 数值越大优先级越低 。
还有一个和使用loadonstartup有关的是使用Struts预编译JSP文件时也可能导致这个异常 。
异常
java.lang.NullPointerException at org.apache.struts.util.RequestUtils.forwardURL(RequestUtils.java:1223)
可能原因
在strutsconfig.xml中的forward元素缺少path属性 。例如应该是如下形式:
异常
javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
Probable Causes
试图在Struts的form标记外使用form的子元素 。这常常发生在你在后面使用Struts的html标 记 。另外要注意可能你不经意使用的无主体的标记,如,这样web 服务器解析时就当作一个无主体的标记 , 随后使用的所有标记都被认为是在这个标记之外的,如又使用了还有就是在使用taglib引入HTML标记库时,你使用的prefix的值不是html 。
异常
javax.servlet.jsp.JspException: Missing message for key xx.xx.xx
Probable Causes
这个key的值对没有在资源文件ApplicationResources.properties中定义 。如果你使用eclipse时经常碰到这样的情况,当项目重新编译时,eclipse会自动将classes目录下的资源文件删除 。
资源文件ApplicationResources.properties 不在classpath中应将资源文件放到WEBINF/classes 目录下 , 当然要在strutsconfig.xml中定义)
异常
Cannot find message resources under key org.apache.struts.action.MESSAGE
可能原因
很显然,这个错误是发生在使用资源文件时,而Struts没有找到资源文件 。
Implicitly trying to use message resources that are not available (such as using empty html:options tag instead of specifyingthe options in its body this assumes options are specified in ApplicationResources.properties file)
XML parser issues too many, too few, incorrect/incompatible versions
异常
Strange and seemingly random characters in HTML and on screen, but not in original JSP or servlet.
可能原因
混和使用Struts的html:form标记和标准的HTML标记不正确 。
使用的编码样式在本页中不支持 。
异常
"Document contained no data" in Netscape
No data rendered (completely empty) page in Microsoft Internet Explorer
可能原因
使用一个Action的派生类而没有实现perform()方法或execute()方法 。在Struts1.0中实现的是perform()方法,在Struts1.1中实现的是execute()方法,但Struts1.1向后兼容perform()方法 。但你使用Struts1.1创建一个Action的派生类,并且实现了execute()方法,而你在Struts1.0中运行的话,就会得到"Document contained nodata" error message in Netscape or a completely empty (no HTML whatsoever) page rendered in Microsoft Internet Explorer.”的错误信息 。
异常
ServletException: BeanUtils.populate
解决方案
在用Struts上传文件时,遇到了javax.servlet.ServletException: BeanUtils.populate异常 。
我的ActionServlet并没有用到BeanUtils这些工具类 。后来仔细检查代码发现是在jsp文件里的form忘了加enctype= amp;quot;multipart/formdata" 了 。所以写程序遇到错误或异常应该从多方面考虑问题存在的可能性 , 想到系统提示信息以外的东西 。

推荐阅读