在struts.xml中使用外部属性

问题描述 投票:1回答:1

我有一个位于我的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>
    ...

可能吗 ?

或者还有其他方法吗?

java properties jboss struts
1个回答
0
投票

没有开箱即用,没有。

最好的选择是使用dynamic result。您需要在启动期间或在运行时以某种方式获取该值,并从操作中填充它。您可能不需要从配置中检索值,但它可能在请求中可用 - 不记得。

© www.soinside.com 2019 - 2024. All rights reserved.