热门文章 | 热门软件| 热门源码 | 热门电影 | 知识库 | 联系我们
软件 源码 教程 影视 健康 招聘
  HTML | JavaScript | ASP | PHP | JSP | NET | VB | VC | VF | Windows | Linux | Mysql | Mssql | Oracle | Struts 
当前位置: 创世纪计算机资源网 -> 文章频道 ->struts 
站内搜索:
小试牛刀-struts与验证
作者:大灰狼 来源:创世纪计算机资源网 整理日期:2007-3-7
这两天搞了一下struts,错误可以说是形态百出,将出一个结论:

错误未必是错误,相同的错误未必相同的问题和相同的解法~

这是最早遇到的错误,其实应该是不存在的,因为一开始的时候引入tld都是正确的,结果一下子出了个这样的错误,原因不知道,但凡是引入了tld的页都出这个错,弄了一个下午,没找出原因,最后重新布署应用,就OK了~

严重: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException: Module null not found.
    at org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:743)
    at org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:360)
    at org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:281)
    at org.apache.struts.taglib.logic.RedirectTag.generateRedirectURL
......


第二个错误:

Missing message for key in bundle or locale zh_CN

javax.servlet.ServletException: Missing message for key "welcome.title" in bundle "(default bundle)" for locale zh_CN


这个有可能是在资源文件中不存在welcome.title,也有可能是没有对应的中文资源文件,或者是没有在配置文件中引入资源文件:

方法:ApplicationResources.properties  拷贝一份至: ApplicationResources_zb_CN.properties

然后在配置文件中引用:

<message-resources parameter="com.zb.struts.ApplicationResources" />
<message-resources parameter="com.zb.struts.ApplicationResources_zb_CN" />

注意,不要把资源文件的扩展名写进去了~
相关文章