这两天搞了一下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" />
注意,不要把资源文件的扩展名写进去了~