org.apache.struts2.convention.annotation

## Annotation Type Action

-     @Target(value={METHOD,TYPE})
      @Retention(value=RUNTIME)
      public @interface Action

  This annotation can be used to control the URL that maps to a specific method in an Action class. By default, the method that is invoked is the execute method of the action and the URL is based on the package and class names. This annotation allows developers to change the URL or invoke a different method. This also allows developers to specify multiple URLs that will be handled by a single class or a single method.

  This can also be used via the `Actions` annotation to associate multiple URLs with a single method.

  Here's an example:

       public class MyAction implements Action {
         @Action("/foo/bar")
         public String execute() {}
       }

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `String` | `className` Allows actions to specify different class name.
    `ExceptionMapping[]` | `exceptionMappings`
    `InterceptorRef[]` | `interceptorRefs` Allows action methods to specify what interceptors must be applied to it.
    `String[]` | `params`
    `Result[]` | `results` Allows action methods to specifically control the results for specific return values.
    `String` | `value` Allows actions to specify different URLs rather than the default that is based on the package and action name.

- - ### Element Detail

    - #### value

          public abstract String value

      Allows actions to specify different URLs rather than the default that is based on the package and action name. This also allows methods other than execute() to be invoked or multiple URLs to map to a single class or a single method to handle multiple URLs.
      Returns:
        The action URL.
      Default:
        "DEFAULT_VALUE"

    - #### results

          public abstract Result[] results

      Allows action methods to specifically control the results for specific return values. These results are not used for other method/URL invocations on the action. These are only used for the URL that this action is associated with.
      Returns:
        The results for the action.
      Default:
        {}

    - #### interceptorRefs

          public abstract InterceptorRef[] interceptorRefs

      Allows action methods to specify what interceptors must be applied to it.
      Returns:
        Interceptors to be applied to the action
      Default:
        {}

    - #### params

          public abstract String[] params

      Returns:
        The parameters passed to the action. This is a list of strings that form a name/value pair chain since creating a Map for annotations is not possible. An example would be: `{"key", "value", "key2", "value2"}`.
      Default:
        {}

    - #### exceptionMappings

          public abstract ExceptionMapping[] exceptionMappings

      Returns:
        Maps return codes to exceptions. The "exceptions" interceptor must be applied to the action.
      Default:
        {}

    - #### className

          public abstract String className

      Allows actions to specify different class name.
      Returns:
        The class name for the action.
      Default:
        "DEFAULT_VALUE"

Copyright © 2000–2019 Apache Software Foundation. All rights reserved.