Updated Branches:
  refs/heads/master cfac7388c -> 1cc2d6782

See JIRA:  https://issues.apache.org/jira/browse/WW-4259

Change to ServletUrlRenderer to not escape an & twice when a query string in 
included in the s:form tags action attribute (e.g. 
action="TestAction?field1=one&field2=two"

Added a test for this use case to FormTagTest.java

Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/1cc2d678
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/1cc2d678
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/1cc2d678

Branch: refs/heads/master
Commit: 1cc2d67826698f6a95582570d5104a10f55976dc
Parents: cfac738
Author: phillips1021 <phillips1...@hotmail.com>
Authored: Sun Jan 19 09:18:01 2014 -0600
Committer: phillips1021 <phillips1...@hotmail.com>
Committed: Sun Jan 19 09:18:01 2014 -0600

----------------------------------------------------------------------
 .../struts2/components/ServletUrlRenderer.java  |  2 +-
 core/src/site/resources/tags/i18n.html          | 96 ++++++++++----------
 .../struts2/views/jsp/ui/FormTagTest.java       | 18 ++++
 .../apache/struts2/views/jsp/ui/Formtag-26.txt  |  1 +
 4 files changed, 68 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/1cc2d678/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java 
b/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
index e9429a9..df72d84 100644
--- a/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
+++ b/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
@@ -162,7 +162,7 @@ public class ServletUrlRenderer implements UrlRenderer {
 
                        ActionMapping mapping = new ActionMapping(actionName, 
namespace, actionMethod, formComponent.parameters);
                        String result = 
urlHelper.buildUrl(formComponent.actionMapper.getUriFromActionMapping(mapping),
-                    formComponent.request, formComponent.response, 
actionParams, null, formComponent.includeContext, true);
+                    formComponent.request, formComponent.response, 
actionParams, null, formComponent.includeContext, true, false, false);
                        formComponent.addParameter("action", result);
 
                        // let's try to get the actual action class and name

http://git-wip-us.apache.org/repos/asf/struts/blob/1cc2d678/core/src/site/resources/tags/i18n.html
----------------------------------------------------------------------
diff --git a/core/src/site/resources/tags/i18n.html 
b/core/src/site/resources/tags/i18n.html
index a022b8a..26b384a 100644
--- a/core/src/site/resources/tags/i18n.html
+++ b/core/src/site/resources/tags/i18n.html
@@ -1,48 +1,48 @@
-<!--
-This file is generated during the build by processing Component class 
annotations.
-Please do not edit it directly.
--->
-<html>
-    <head>
-               <title>i18n</title>
-       </head>
-
-       <body>
-               <h1>Tag Name: i18n</h1>
-               <h2>Description</h2>
-               <p>
-               <!-- START SNIPPET: tagdescription -->
-               Get a resource bundle and place it on the value stack
-               <!-- END SNIPPET: tagdescription -->
-               </p>
-
-               <h2>Attributes</h2>
-               <!-- START SNIPPET: tagattributes -->
-               <table width="100%">
-                       <tr>
-                               <td colspan="6"><h4>Dynamic Attributes 
Allowed:</h4> false</td>
-                       </tr>
-                       <tr>
-                               <td colspan="6">&nbsp;</td>
-                       </tr>
-                       <tr>
-                               <th align="left" valign="top"><h4>Name</h4></th>
-                               <th align="left" 
valign="top"><h4>Required</h4></th>
-                               <th align="left" 
valign="top"><h4>Default</h4></th>
-                               <th align="left" 
valign="top"><h4>Evaluated</h4></th>
-                               <th align="left" valign="top"><h4>Type</h4></th>
-                               <th align="left" 
valign="top"><h4>Description</h4></th>
-                       </tr>
-                               <tr>
-                                       <td align="left" valign="top">name</td>
-                                       <td align="left" 
valign="top"><strong>true</strong></td>
-                                       <td align="left" 
valign="top">String</td>
-                                       <td align="left" valign="top">false</td>
-                                       <td align="left" 
valign="top">String</td>
-                                       <td align="left" valign="top">Name of 
resource bundle to use (eg foo/bar/customBundle)</td>
-                               </tr>
-               </table>
-               <!-- END SNIPPET: tagattributes -->
-       </body>
-</html>
-
+<!--
+This file is generated during the build by processing Component class 
annotations.
+Please do not edit it directly.
+-->
+<html>
+    <head>
+               <title>i18n</title>
+       </head>
+
+       <body>
+               <h1>Tag Name: i18n</h1>
+               <h2>Description</h2>
+               <p>
+               <!-- START SNIPPET: tagdescription -->
+               Get a resource bundle and place it on the value stack
+               <!-- END SNIPPET: tagdescription -->
+               </p>
+
+               <h2>Attributes</h2>
+               <!-- START SNIPPET: tagattributes -->
+               <table width="100%">
+                       <tr>
+                               <td colspan="6"><h4>Dynamic Attributes 
Allowed:</h4> false</td>
+                       </tr>
+                       <tr>
+                               <td colspan="6">&nbsp;</td>
+                       </tr>
+                       <tr>
+                               <th align="left" valign="top"><h4>Name</h4></th>
+                               <th align="left" 
valign="top"><h4>Required</h4></th>
+                               <th align="left" 
valign="top"><h4>Default</h4></th>
+                               <th align="left" 
valign="top"><h4>Evaluated</h4></th>
+                               <th align="left" valign="top"><h4>Type</h4></th>
+                               <th align="left" 
valign="top"><h4>Description</h4></th>
+                       </tr>
+                               <tr>
+                                       <td align="left" valign="top">name</td>
+                                       <td align="left" 
valign="top"><strong>true</strong></td>
+                                       <td align="left" 
valign="top">String</td>
+                                       <td align="left" valign="top">false</td>
+                                       <td align="left" 
valign="top">String</td>
+                                       <td align="left" valign="top">Name of 
resource bundle to use (eg foo/bar/customBundle)</td>
+                               </tr>
+               </table>
+               <!-- END SNIPPET: tagattributes -->
+       </body>
+</html>
+

http://git-wip-us.apache.org/repos/asf/struts/blob/1cc2d678/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java 
b/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
index 9f4b5d2..77fac5d 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
@@ -45,6 +45,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import static org.apache.struts2.views.jsp.AbstractUITagTest.normalize;
 
 
 /**
@@ -52,6 +53,23 @@ import java.util.Set;
  */
 public class FormTagTest extends AbstractUITagTest {
 
+    
+     public void testFormWithActionAttributeContainingQueryString() throws 
Exception {
+        FormTag tag = new FormTag();
+        tag.setPageContext(pageContext);
+        tag.setName("myForm");
+        tag.setMethod("post");
+        tag.setAcceptcharset("UTF-8");
+        tag.setAction("testAction?paramone=one&paramtwo=two");
+        tag.setEnctype("myEncType");
+        tag.setTitle("mytitle");
+        tag.setOnsubmit("submitMe()");
+        tag.doStartTag();
+        tag.doEndTag();
+        
+        verify(FormTag.class.getResource("Formtag-26.txt"));
+    }
+    
     public void testFormWithActionAttributeContainingBothActionAndMethod() 
throws Exception {
         FormTag tag = new FormTag();
         tag.setPageContext(pageContext);

http://git-wip-us.apache.org/repos/asf/struts/blob/1cc2d678/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-26.txt
----------------------------------------------------------------------
diff --git 
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-26.txt 
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-26.txt
new file mode 100644
index 0000000..bb9d66a
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-26.txt
@@ -0,0 +1 @@
+<formid="testAction"name="myForm"onsubmit="submitMe()"action="/testAction.action?paramone=one&amp;paramtwo=two"method="post"enctype="myEncType"title="mytitle"accept-charset="UTF-8"><tableclass="wwFormTable"></table></form>
\ No newline at end of file

Reply via email to