View Javadoc

1   /*
2    * $Id: Action.java 502296 2007-02-01 17:33:39Z niallp $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts2;
22  
23  /***
24   * Default action interface. Provided purely for user convenience. Struts does not require actions to implement any
25   * interfaces. Actions need only implement a public, no argument method which returns {@code String}. If a user does
26   * not specify a method name, Struts defaults to {@code execute()}.
27   *
28   * <p>For example:
29   *
30   * <pre>
31   *   static import ResultNames.*;
32   *
33   *   public class MyAction <b>implements Action</b> {
34   *
35   *     public String execute() {
36   *       return SUCCESS;
37   *     }
38   *   }
39   * </pre>
40   *
41   * <p>is equivalent to:
42   *
43   * <pre>
44   *   static import ResultNames.*;
45   *
46   *   public class MyAction {
47   *
48   *     public String execute() {
49   *       return SUCCESS;
50   *     }
51   *   }
52   * </pre>
53   *
54   * @author crazybob@google.com (Bob Lee)
55   */
56  public interface Action {
57  
58      /***
59       * Executes this action.
60       *
61       * @return result name which matches a result name from the action mapping in the configuration file. See {@link
62       *  ResultNames} for common suggestions.
63       */
64      String execute();
65  }