struts1练习时的报错
2014-03-29 22:31
218 查看
需求:
解决Cannot find message resources under key org.apache.struts.action.MESSAGE错误,今天在用struts1.3做一个注册页面时出现的错误。
前提条件:
struts-config.xml 存在如下配置:
<!-- 消息文件 -->
<message-resources parameter="application"/>
<message-resources parameter="popedom"/>
JSP的调用方式:
System.out.println(TagUtils.getInstance().message(pageContext, "popedom", Globals.LOCALE_KEY, "username"));
出现问题:
老报异常:not find message resources under key popedom ...
解决办法:
struts-config.xml 增加配置:
<!-- 消息文件 -->
<message-resources parameter="applicationResources"></message-resources>
该设置最好放在:</action-mappings>"放到这里"</struts-config>;
确保ApplicationResources.properties文件在你建立的WEB-INF\classes文件夹中;
问题出现原因:
struts必须有一个不带key的资源文件,
若对 applicationresource.preperties 资源文件不指定 key 的话,JSP在通过 TagUtils 类指定的 Bundle 是“applicationresource”,而在 struts-config.xml 中的资源文件没有哪个的指定其key为“applicationresource”,最终导致出现异常
解决Cannot find message resources under key org.apache.struts.action.MESSAGE错误,今天在用struts1.3做一个注册页面时出现的错误。
前提条件:
struts-config.xml 存在如下配置:
<!-- 消息文件 -->
<message-resources parameter="application"/>
<message-resources parameter="popedom"/>
JSP的调用方式:
System.out.println(TagUtils.getInstance().message(pageContext, "popedom", Globals.LOCALE_KEY, "username"));
出现问题:
老报异常:not find message resources under key popedom ...
解决办法:
struts-config.xml 增加配置:
<!-- 消息文件 -->
<message-resources parameter="applicationResources"></message-resources>
该设置最好放在:</action-mappings>"放到这里"</struts-config>;
确保ApplicationResources.properties文件在你建立的WEB-INF\classes文件夹中;
问题出现原因:
struts必须有一个不带key的资源文件,
若对 applicationresource.preperties 资源文件不指定 key 的话,JSP在通过 TagUtils 类指定的 Bundle 是“applicationresource”,而在 struts-config.xml 中的资源文件没有哪个的指定其key为“applicationresource”,最终导致出现异常
相关文章推荐
- JQuery+Strusts1.x无刷新登录
- MySQL抛出Incorrect string value异常分析
- javaweb之web入门基础
- java struts常见错误以及原因分析
- .NET(C#):Emit创建异常处理的方法
- windows7服务器上weblogic启动失败异常解决方法
- 有关ajax的error与后台的异常问题解决
- Struts之logic标签库详解
- 深入探讨JAVA中的异常与错误处理
- C++ 异常处理 catch(...)介绍
- 格式导致的Excel导入sql出现异常的解决方法
- SSH框架网上商城项目第20战之在线支付平台
- JavaWeb中struts2实现文件上传下载功能实例解析
- java 代码中预防空指针异常的处理办法
- Python 错误和异常小结
- php Try Catch异常测试
- java实现非法访问异常示例
- 自定义异常类和抛出异常的方法
- MyEclipse7.5+JDK1.6+Tomcat6+Struts1.3+MySQL4.1开发演示
- struts使用拦截器注解