Author: tmjee
Date: Sun May  7 00:44:05 2006
New Revision: 404739

URL: http://svn.apache.org/viewcvs?rev=404739&view=rev
Log:
ww-1307



Added:
    
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-10.txt
   (with props)
    
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-9.txt
   (with props)
Modified:
    
incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Form.java
    
incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/FormTagTest.java

Modified: 
incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Form.java
URL: 
http://svn.apache.org/viewcvs/incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Form.java?rev=404739&r1=404738&r2=404739&view=diff
==============================================================================
--- 
incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Form.java
 (original)
+++ 
incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Form.java
 Sun May  7 00:44:05 2006
@@ -173,16 +173,17 @@
                 action = uri.substring(uri.lastIndexOf('/'));
             }
         }
+        
+        String actionMethod = "";
+        if (action.indexOf("!") != -1) {
+               int endIdx = action.lastIndexOf("!");
+               actionMethod = action.substring(endIdx+1, action.length());
+               action = action.substring(0, endIdx);
+        }
 
         final ActionConfig actionConfig = 
ConfigurationManager.getConfiguration().getRuntimeConfiguration().getActionConfig(namespace,
 action);
         String actionName = action;
         if (actionConfig != null) {
-            String actionMethod = "";
-            if (action.indexOf("!") != -1) {
-                int endIdx = action.lastIndexOf("!");
-                actionMethod = action.substring(endIdx + 1, action.length());
-                action = action.substring(0, endIdx);
-            }
 
             ActionMapping mapping = new ActionMapping(action, namespace, 
actionMethod, parameters);
             String result = 
UrlHelper.buildUrl(ActionMapperFactory.getMapper().getUriFromActionMapping(mapping),
 request, response, null);

Modified: 
incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/FormTagTest.java
URL: 
http://svn.apache.org/viewcvs/incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/FormTagTest.java?rev=404739&r1=404738&r2=404739&view=diff
==============================================================================
--- 
incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/FormTagTest.java
 (original)
+++ 
incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/FormTagTest.java
 Sun May  7 00:44:05 2006
@@ -35,6 +35,47 @@
  */
 public class FormTagTest extends AbstractUITagTest {
 
+       public void testFormWithActionAttributeContainingBothActionAndMethod() 
throws Exception {
+               TestAction testAction = (TestAction) action;
+               
+               FormTag tag = new FormTag();
+               tag.setPageContext(pageContext);
+               tag.setName("myForm");
+               tag.setMethod("POST");
+               tag.setAcceptcharset("UTF-8");
+        tag.setAction("testAction!myLittleMethod");
+        tag.setEnctype("myEncType");
+        tag.setTitle("mytitle");
+        tag.setOnsubmit("submitMe()");
+        
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(FormTag.class.getResource("Formtag-9.txt"));
+       }
+       
+       
+       public void 
testFormWithActionAttributeContainingBothActionAndMethodAndNamespace() throws 
Exception {
+               TestAction testAction = (TestAction) action;
+               
+               FormTag tag = new FormTag();
+               tag.setPageContext(pageContext);
+               tag.setName("myForm");
+               tag.setNamespace("/testNamespace");
+               tag.setMethod("POST");
+               tag.setAcceptcharset("UTF-8");
+        tag.setAction("testNamespaceAction!myLittleMethod");
+        tag.setEnctype("myEncType");
+        tag.setTitle("mytitle");
+        tag.setOnsubmit("submitMe()");
+        
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(FormTag.class.getResource("Formtag-10.txt"));
+       }
+       
+       
     public void testForm() throws Exception {
        
         request.setupGetServletPath("/testAction");

Added: 
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-10.txt
URL: 
http://svn.apache.org/viewcvs/incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-10.txt?rev=404739&view=auto
==============================================================================
--- 
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-10.txt
 (added)
+++ 
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-10.txt
 Sun May  7 00:44:05 2006
@@ -0,0 +1,7 @@
+<form id="testNamespaceAction" name="myForm" onsubmit="submitMe(); return 
true;" action="/testNamespace/testNamespaceAction!myLittleMethod.action" 
method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
+<table class="wwFormTable">
+</table>
+</form>
+
+<!-- javascript that is needed for tooltips -->
+<script language="JavaScript" 
type="text/javascript">dojo.require("dojo.widget.html.Tooltip");dojo.require("dojo.fx.html");</script>

Propchange: 
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-10.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-9.txt
URL: 
http://svn.apache.org/viewcvs/incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-9.txt?rev=404739&view=auto
==============================================================================
--- 
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-9.txt
 (added)
+++ 
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-9.txt
 Sun May  7 00:44:05 2006
@@ -0,0 +1,7 @@
+<form id="testAction" name="myForm" onsubmit="submitMe(); return true;" 
action="/testAction!myLittleMethod.action" method="POST" enctype="myEncType" 
title="mytitle" accept-charset="UTF-8">
+<table class="wwFormTable">
+</table>
+</form>
+
+<!-- javascript that is needed for tooltips -->
+<script language="JavaScript" 
type="text/javascript">dojo.require("dojo.widget.html.Tooltip");dojo.require("dojo.fx.html");</script>

Propchange: 
incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Formtag-9.txt
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to