gpt4 book ai didi

java - 在 struts.xml 中使用外部属性

转载 作者:太空宇宙 更新时间:2023-11-04 09:44:49 26 4
gpt4 key购买 nike

我的 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>
...

可能吗?

或者还有其他方法可以做到这一点吗?

最佳答案

不是开箱即用的,不。

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

关于java - 在 struts.xml 中使用外部属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55532548/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com