Commits

Anonymous committed d446656

default params for results now supported via a public static String DEFAULT_PARAM
Issue number: XW-66
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk/src@19e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 6b9c6e7

Comments (0)

Files changed (2)

File java/com/opensymphony/xwork/ActionChainResult.java

     //~ Static fields/initializers /////////////////////////////////////////////
 
     private static final Log log = LogFactory.getLog(ActionChainResult.class);
+    public static final String DEFAULT_PARAM = "actionName";
 
     //~ Instance fields ////////////////////////////////////////////////////////
 

File java/com/opensymphony/xwork/config/providers/XmlConfigurationProvider.java

 
                 HashMap params = XmlHelper.getParams(resultElement);
 
-                if (params.size() == 0) // maybe we just have a body - therefore a default location parameter
+                if (params.size() == 0) // maybe we just have a body - therefore a default parameter
                  {
-                    // if <result ...>something</result> then we add a location parameter of 'something' as this is the most used result param
+                    // if <result ...>something</result> then we add a parameter of 'something' as this is the most used result param
                     if ((resultElement.getChildNodes().getLength() == 1) && (resultElement.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE)) {
                         params = new HashMap();
-                        params.put("location", resultElement.getChildNodes().item(0).getNodeValue());
+                        try {
+                            String paramName = (String) resultClass.getField("DEFAULT_PARAM").get(null);
+                            params.put(paramName, resultElement.getChildNodes().item(0).getNodeValue());
+                        } catch (Throwable t) {
+                        }
                     }
                 }