struts-config message-resources配置问题总结
問題:我的app無法讀取配置好的ApplicationResources.properties中的內容
解答:文件目錄為
/webapp
/WEB-INF
/classes
ApplicationResources.properties
/xxx
/yyy
SomeOther.properties
struts-config.xml的內容是
?<message-resources parameter="ApplicationResources"/>
?<message-resources parameter="xxx.yyy.SomeOther"/>
請問struts如何知道你要讀取哪個的內容?所以,要添加key屬性以示區別
<message-resources key="org.apache.struts.action.MESSAGE" parameter="ApplicationResources"/>
<message-resources key="lqr-rp-res" parameter="xxx.yyy.SomeOther"/>
其中,如果key的值為org.apache.struts.action.MESSAGE那么該properties文件的內容可以被struts的ActionForm中的ActionMessage/ActionErrors使用,否則,會拋出異常
javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE轉載于:https://www.cnblogs.com/qrlozte/p/3549567.html
總結
以上是生活随笔為你收集整理的struts-config message-resources配置问题总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: spacy库的安装与使用_为 SpaCy
- 下一篇: Drools 规则引擎一文读懂