Struts2.5 从 struts.xml 获取 Struts 常量以获得自定义结果

Struts2.5 Get Struts Constant From struts.xml For Custom Result

我已经为 Struts2 编写了自定义结果,想知道在 struts.xml 中访问 <constants> 的正确方法吗?我曾尝试在文档中搜索 Struts,但到目前为止一无所获。

我试图在 Struts 文档中找到用于编写自定义结果类型的页面,但我找不到它。这是关于一般结果类型的页面,但它对我想要实现的目标确实没有帮助。

https://struts.apache.org/docs/result-types.html

com.opensymphony.xwork2.inject.Inject 注释注入它。

在您的自定义结果中:

@Inject(value = "custom.const.some")
private String some;

在struts.xml中:

<constant name="custom.const.some" value="constant_for_custom_result" />