1

我使用如下方法创建了一个操作:

public class NomenclatureAction extends ActionSupport {

    // ...

    @Actions({
      @Action(value = "ajaxDoStuff",
              results = {
                    @Result(name = ActionSupport.SUCCESS, location = "success.jsp"),
                    @Result(name = ActionSupport.INPUT, location = "fail.jsp") 
              }),
      @Action(value = "index.action",
              results = {
                    @Result(name = ActionSupport.SUCCESS, location = "success.jsp"),
                    @Result(name = ActionSupport.INPUT, location = "fail.jsp") 
              })
    })
    public final String doStuff() {
        // ...
        return ActionSupport.SUCCESS;
    }

}

我想doStuff使用以下 URL 之一调用相同的方法:

到目前为止,它适用于前两个 URL,但不适用于后两个。
我错过了什么?

4

1 回答 1

1

value属性不应包含扩展名。

@Action(value = "index.action",
  results = {
        @Result(name = ActionSupport.SUCCESS, location = "success.jsp"),
        @Result(name = ActionSupport.INPUT, location = "fail.jsp") 
  })

您也可以尝试http://my-server.com/public/namespace使用默认启用的约定 uknown 处理程序来处理哪个。

于 2016-01-27T11:24:59.803 回答