Java struts2中的属性文件位置

Java struts2中的属性文件位置,java,configuration,struts2,localization,internationalization,Java,Configuration,Struts2,Localization,Internationalization,我在应用程序中使用Struts2。我有一个MessageResources.properties,其中给出了所有键和值。此文件位于${tomcat_home}/properties/resources位置。我的问题是如何在struts.xml中提供此文件位置?在struts.xml中,我尝试了 <constant name="struts.custom.i18n.resources" value="/usr/local/tomcat/properties/resources/Message

我在应用程序中使用Struts2。我有一个
MessageResources.properties
,其中给出了所有键和值。此文件位于
${tomcat_home}/properties/resources
位置。我的问题是如何在
struts.xml
中提供此文件位置?在
struts.xml
中,我尝试了

<constant name="struts.custom.i18n.resources" value="/usr/local/tomcat/properties/resources/MessageResources"/>


但这是行不通的。未检索属性。

Struts2从类路径加载属性。将属性文件放在给定包下的
src
resources
文件夹中

如果包名为
com.example.resources
,则应使用

<constant name="struts.custom.i18n.resources" value="/com/example/resources/MessageResources"/>


为什么要从类路径外部加载属性?因为我的两个war文件使用相同的资源文件。我需要将资源放在tomcat文件夹中,因为我的两个war文件使用相同的资源文件。有可能吗?有可能,但不推荐这样做。因此,如果我在tomcat文件夹中提供资源,正如我在问题中提到的,如何在strtus.xml中提供路径?您必须使用类路径的相对路径。我已将资源放在
tomcat/properties/resources/myproj
中。我在classpath和
struts.xml
give
resources.myproj.MessageResources
中添加了属性文件夹。但它也不起作用