commandactionfactoryproxy.java

来自「webwork source」· Java 代码 · 共 76 行

JAVA
76 行
字号
/* * WebWork, Web Application Framework * * Distributable under Apache license. * See terms of license at opensource.org */package webwork.action.factory;import webwork.action.Action;import webwork.action.CommandDriven;import webwork.action.ActionContext;/** * Executes a "command" within an action specified either as part of the * action name or as a parameter value. * * @author Rickard 謆erg (rickard@middleware-company.com) * @version $Revision: 1.11 $ */public class CommandActionFactoryProxy   extends ActionFactoryProxy{   // Attributes ----------------------------------------------------   // Constructors --------------------------------------------------   public CommandActionFactoryProxy(ActionFactory aFactory)   {      super(aFactory);   }   // ActionFactory overrides ---------------------------------------  /**   * Locates the matching action object from the action factory proxy chain   * and then executes a command on it if the {@link CommandDriven} interface   * is implemented.  The command is determined either by using the text   * after the <code>"!"</code> in the action name or from the value of the   * first parameter named   * <code>"command."</code>   *   * @param  aName   * @return action from the next action factory proxy   * @exception  Exception   */   public Action getActionImpl(String aName)     throws Exception   {      // Set command that was used as part of action name      int idx = aName.lastIndexOf("!");      if (idx != -1)      {         String command = aName.substring(idx+1);         String actionName = aName.substring(0, idx);         Action action = getNextFactory().getActionImpl(actionName);         if (action instanceof CommandDriven)         {            ((CommandDriven)action).setCommand(command);         }         return action;      }      Action action = getNextFactory().getActionImpl(aName);      if (action instanceof CommandDriven)      {         // Set command that was sent in as a parameter         String[] commandParam = ((String[])ActionContext.getParameters().get("command"));         if (commandParam != null)         {            ((CommandDriven)action).setCommand(commandParam[0]);         }      }      return action;   }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?