在struts.xml中使用外部属性

时间:2019-04-05 09:43:49

标签: java properties jboss struts

我在Jboss conf文件夹中有一个config.properties。

config.properties

server.url=http://localhost:8085/

我想在我的 struts.xml 中使用此属性:

    ...
    <action name="logoutAction" class="app.LogoutAction">
         <result name="ok" type="httpheader">
          <param name="status">301</param>
          <param name="headers.location">server.url</param>
         </result>
    </action>
    ...

有可能吗?

或者还有其他方法吗?

1 个答案:

答案 0 :(得分:0)

不是开箱即用的。

最好的选择是使用dynamic result。您需要在启动时或运行时以某种方式获取该值,然后从操作中将其填写。虽然您可能不需要从配置中检索值,但它可能在请求中可用-别回想。