Struts&Debug Information
来源:互联网 发布:淘宝打假怎么套话 编辑:程序博客网 时间:2024/06/16 04:25
---------整理添加 by dickwin
以下所说的struts-config.xml和ApplicationResources.properties等文件名是缺省时使用的,如果你使用了多模块,或指定了不同的资源文件名称,这些名字要做相应的修改。
1、“No bean found under attribute key XXX”在struts-config.xml里定义了一个ActionForm,但type属性指定的类不存在,type属性的值应该是Form类的全名。或者是,在Action的定义中,name或attribute属性指定的ActionForm不存在.特别注意区分大小写!
2、“Cannot find bean XXX in any scope”在Action里一般会request.setAttribute()一些对象,然后在转向的jsp文件里(用tag或request.getAttribute()方法)得到这些对象并显示出来。这个异常是说jsp要得到一个对象,但前面的Action里并没有将对象设置到request(也可以是session、servletContext)里。可能是名字错了,请检查jsp里的tag的一般是name属性,或getAttribute()方法的参数值;或者是Action逻辑有问题没有执行setAttribute()方法就先转向了。还有另外一个可能,纯粹是jsp文件的问题,例如<logic:iterate>会指定一个id值,然后在循环里<bean:write>使用这个值作为name的值,如果这两个值不同,也会出现此异常。(都是一个道理,request里没有对应的对象。)
3、“Missing message for key "XXX"”缺少所需的资源,检查ApplicationResources.properties文件里是否有jsp文件里需要的资源,例如:
<bean:message key="msg.name.prompt"/>
这行代码会找msg.name.prompt资源,如果AppliationResources.properties里没有这个资源就会出现本异常。在使用多模块时,要注意在模块的struts-config-xxx.xml里指定要使用的资源文件名称,否则当然什幺资源也找不到,这也是一个很容易犯的错误。
4、“No getter method for property XXX of bean teacher”这条异常信息说得很明白,jsp里要取一个bean的属性出来,但这个bean并没有这个属性。你应该检查jsp中某个标签的property属性的值。例如下面代码中的cade应该改为code才对:
<bean:write name="teacher" property="cade" filter="true"/>
注意在Form里的比如 是EmpNo 而在Form 的set,get方法的时候是 empNo 此处可能出错﹐注意为上﹔
5、“Cannot find ActionMappings or ActionFormBeans collection”待解决﹐检查配置文件,从Sturts-config-xml到web.xml看是否对应﹔
6、“Cannot retrieve mapping for action XXX”在.jsp的<form>标签里指定action='/XXX',但这个Action并未在struts-config.xml里设置过。
7、HTTP Status 404 - /xxx/xxx.jspForward的path属性指向的jsp页面不存在,请检查路径和模块,对于同一模块中的Action转向,path中不应包含模块名;模块间转向,记住使用contextRelative="true"。
8、没有任何异常信息,显示空白页面可能是Action里使用的forward与struts-config.xml里定义的forward名称不匹配。
9、“The element type "XXX" must be terminated by the matching end-tag "XXX".”这个是struts-config.xml文件的格式错误,仔细检查它是否是良构的xml文件,关于xml文件的格式这里就不赘述了。
10、“Servlet.init() for servlet action threw exception”一般出现这种异常在后面会显示一个关于ActionServlet的异常堆栈信息,其中指出了异常具体出现在代码的哪一行。我曾经遇到的一次提示如下:
java.lang.NullPointerException at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1003) at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
为解决问题,先下载struts的源码包,然后在ActionServlet.java的第1003行插入断点,并对各变量进行监视。很丢人,我竟然把struts-config.xml文件弄丢了,因此出现了上面的异常,应该是和CVS同步时不小心删除的。
11、“Resources not defined for Validator”这个是利用Validator插件做验证时可能出现的异常,这时你要检查validation.xml文件,看里面使用的资源是否确实有定义,form的名称是否正确,等等。
- Struts&Debug Information
- debug information template:
- debug information of executable
- 调试 函数TRACE("debug information");
- debug absent line number information
- binary was not built with debug information
- cocoa debug information putout to console
- Binary was not build with debug information
- debug下 no matching symbolic information found
- debug下 no matching symbolic information found
- binary was not built with debug information
- binary was not built with debug information
- Eclipse Debug Absent Line Number Information
- PLSQL debug提示no debug information的解决
- struts+hibernate项目debug总结
- struts+hibernate项目debug总结
- struts+hibernate项目debug总结
- struts+hibernate项目debug总结
- MTU等参数在注册表中的位置
- 推销IT:论信息文化的输出
- Crystal report 出现maximum report processing jobs limit configured by your system administrator has been reached错误的解决办法.
- windows自动登陆
- 资源搜索google高级篇
- Struts&Debug Information
- Struts+Spring+Hibernate快速入门
- Eclipse GUI 入门
- JavaME 开发流程详解
- Struts中如何用taglib实现下拉选择筐
- 在J2ME开发中解析XML
- ANT工程打包文件
- Junit in Action 读书笔记序
- sniffit的安装使用简述(linux)(http://www.xfocus.net/articles/200001/28.html)