You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by pb...@apache.org on 2007/04/09 05:52:51 UTC

svn commit: r526641 - /struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractSelectInput.java

Author: pbenedict
Date: Sun Apr  8 20:52:50 2007
New Revision: 526641

URL: http://svn.apache.org/viewvc?view=rev&rev=526641
Log:
STR-3025: Search for INPUT mapping

Modified:
    struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractSelectInput.java

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractSelectInput.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractSelectInput.java?view=diff&rev=526641&r1=526640&r2=526641
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractSelectInput.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractSelectInput.java Sun Apr  8 20:52:50 2007
@@ -22,6 +22,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.Action;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.config.ActionConfig;
 import org.apache.struts.config.ForwardConfig;
@@ -74,16 +75,36 @@
                 LOG.trace("Finding ForwardConfig for '" + input + "'");
             }
 
-            forwardConfig = actionConfig.findForwardConfig(input);
-
-            if (forwardConfig == null) {
-                forwardConfig = moduleConfig.findForwardConfig(input);
+            // If the input parameter is specified, use that, otherwise try
+            // to find one in the mapping or the module under the standard
+            // conventional "input" name.
+            if (input != null) {
+                forwardConfig = actionConfig.findForwardConfig(input);
+                if (forwardConfig == null) {
+                    forwardConfig = moduleConfig.findForwardConfig(input);
+                }
+            } else {
+                forwardConfig = actionConfig.findForwardConfig(Action.INPUT);
+                if (forwardConfig == null) {
+                    forwardConfig = moduleConfig.findForwardConfig(Action.INPUT);
+                }
             }
         } else {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Delegating to forward() for '" + input + "'");
             }
 
+            // If no input parameter is specified, try to find one in the 
+            // module under the standard conventional "input" name. Because
+            // the Controller is not setup to treat the input parameter as
+            // a mapping, the action mapping check is skipped.
+            if (input == null) {
+                forwardConfig = moduleConfig.findForwardConfig(Action.INPUT);
+                if (forwardConfig != null) {
+                    input = Action.INPUT;
+                }
+            }
+            
             forwardConfig = forward(actionCtx, moduleConfig, input);
         }