可以在 struts.xml 中指定任何 struts 属性 吗?

Can any struts property be specified in struts.xml instead?

是否可以在 struts.xml 中指定 struts.properties 文件中的任何 Struts 常量?这将使我们能够使用环境变量

设置值

例如可以在属性文件中加入以下常量:

struts.ognl.logMissingProperties=true
struts.el.throwExceptionOnFailure=false

改为在struts.xml中指定如下?

<constant name="struts.ognl.logMissingProperties" value="${env.logmissing}"/>
<constant name="struts.el.throwExceptionOnFailure" value="${env.throwExc}"/>

struts.properties中的配置属性可以struts.xml中指定。如果没有 struts.xml,第一个文件可用于更改全局属性。

因此 struts.properties 文件中的属性将在 struts.xml:

<constant name="struts.ognl.logMissingProperties" value="true"/>
<constant name="struts.el.throwExceptionOnFailure" value="false"/>