javastruts2struts2-convention-plugin

Action not found, why not?


I have created an action with a method like below:

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;
    }

}

I want to call the same method doStuff with one of the URLs below:

So far, it works for the first two URLs but not for the last two ones.
What am I missing?


Solution

  • The value attribute should not contain an extension.

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

    You might also try http://my-server.com/public/namespace which should be handled by the convention uknown handler, which is enabled by default.