升级到 2.5.26 后 Struts 通配符映射不起作用

时间:2021-03-04 21:43:55

标签: java struts2

我有一个使用通配符映射的操作类。它在 struts 2.5.22 中工作,但我尝试升级到 2.5.26(和 2.5.25),现在从未调用 setType。

@Component
@Namespace("/applications/proxy")
@Flow(purgeAllBefore = "Y")
@Action(value = "{type}")
@Results({@Result(name = "input", type = "dispatcher", location = "/jsp/applications/proxy.jsp"),
          @Result(name = "success", type = "redirectAction", location = "${type}", params = {"namespace", "/applications"}),
          @Result(name = "auto-select", type = "redirectAction", location = "${autoSelectUrl}", params = {"namespace", "/"})})
public class ProxyAction extends SearchSupport {
  // Struts wildcard action mapping variable for the attachment, for example: 'J', 'R', 'I', 'N', 'H'
  private String type;
 
  public String getType() {
    return type;
  }
 
  public void setType(String type) {
    this.type = type;
  }
...

1 个答案:

答案 0 :(得分:0)

好的,我发现了问题。 strutsconfig 文件中需要这一行,但文档中不需要:

<constant name="struts.matcher.appendNamedParameters" value="true"/>