struts.properties文件在WEB-INF/classes目录下存放。
这个文件用来配置Struts2系统的一些基本规约,所有在struts.properties中配置的内容都可以在struts.xml中配置,或者web.xml中在struts2 filter中配置,例如:
Struts.properties中的如下配置:
相当于struts.xml中的如下配置:
相当于web.xml中的如下配置:
这个文件用来配置Struts2系统的一些基本规约,所有在struts.properties中配置的内容都可以在struts.xml中配置,或者web.xml中在struts2 filter中配置,例如:
Struts.properties中的如下配置:
struts.i18n.encoding=UTF-8相当于struts.xml中的如下配置:
<constant name=“struts.i18n.encoding” value=“true” />相当于web.xml中的如下配置:
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
<init-param>
<param-name>struts.i18n.encoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
本文详细介绍了Struts2框架中的struts.properties文件的作用及其配置方式。该文件位于WEB-INF/classes目录下,用于设置Struts2的基本规则。文章还对比了在struts.xml及web.xml中配置相同参数的方法。
214

被折叠的 条评论
为什么被折叠?



