[ 
https://issues.apache.org/jira/browse/WW-4259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13873386#comment-13873386
 ] 

Bruce Phillips edited comment on WW-4259 at 1/16/14 1:59 PM:
-------------------------------------------------------------

I figured out why I could not originally duplicate the issue you reported.

In your struts.xml you have this statement:

   <default-action-ref name="TestPage"/>

In my struts.xml I did not include a default-action-ref statement.

If I remove your default-action-ref statement from your struts.xml then I get 
the form HTML tag rendered as follows in your JSP:

<form id="testform" name="testform" action="TestPage.action" method="post">

With the default-action-ref statement in place I get the form tag rendered in 
the JSP as

{code:xml}
<form id="testform" name="testform" 
action="/formtest/TestPage.action?field1=111&amp;amp;field2=222" method="post"> 
  
{code}

{code:xml}
(note the &amp;amp; which your reported as a problem)
{code}

I don't understand why default-action-ref statement is causing the action 
attribute of the form tag to format differently.  I'm going to post a question 
on the Struts 2 developer's mailing list to see if one of the more experienced 
developers has some ideas.

Bruce


was (Author: bphillips):
I figured out why I could not originally duplicate the issue you reported.

In your struts.xml you have this statement:

   <default-action-ref name="TestPage"/>

In my struts.xml I did not include a default-action-ref statement.

If I remove your default-action-ref statement from your struts.xml then I get 
the form HTML tag rendered as follows in your JSP:

<form id="testform" name="testform" action="TestPage.action" method="post">

With the default-action-ref statement in place I get the form tag rendered in 
the JSP as

{code:xml}
<form id="testform" name="testform" 
action="/formtest/TestPage.action?field1=111&amp;amp;field2=222" method="post"> 
  
{code}

(note the &amp;amp; which your reported as a problem)

I don't understand why default-action-ref statement is causing the action 
attribute of the form tag to format differently.  I'm going to post a question 
on the Struts 2 developer's mailing list to see if one of the more experienced 
developers has some ideas.

Bruce

> Parameter is NULL when Submitting form with parameters using URL contains 
> querystring consisted of some fields
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-4259
>                 URL: https://issues.apache.org/jira/browse/WW-4259
>             Project: Struts 2
>          Issue Type: Bug
>         Environment: Struts: 2.3.16
> JRE: 7.0
> Tomcat: 7.0
>            Reporter: Yorozuya Kazuyuki
>            Assignee: Bruce Phillips
>            Priority: Minor
>             Fix For: 2.3.17
>
>         Attachments: ServletUrlRenderer.java.patch, 
> formtest-0.0.1-SNAPSHOT.war, formtest.zip
>
>
> h3. Phenomenon
> 1. Submitting form with parameters using URL contains querystring consisted 
> of some fields.
> {noformat}
> <s:form id="testForm" action="Test.action?field1=%{field1}&field2=%{field2}">
> {noformat}
> Field1, field2 are member of Test class.
> Each setter is implemented in this class.
> \\
> 2. When form tag in struts is interpreted as in HTML, "action" atrribute is 
> this.
> {noformat}
> action="Test.action?field1=value1&amp;amp;field2=value2"
> {noformat}
> Due to duplication of "amp;", it causes field2 member to fail to recieve 
> value.
> therefore, field2 member equals NULL always.
>  
> \\
> Desired result 2. is this.
> {noformat}
> action="Test.action?field1=value1&amp;field2=value2"
> {noformat}
> \\
> h3. Cause
> Character entity reference about "&" is executed twice.
> Executed points are as follow.
> --------------------------------------------------------------------------------
> ・/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java
> {noformat}
> String buildUrl(
>  String action, HttpServletRequest request, HttpServletResponse response, 
>  Map<String, Object> params, String scheme, boolean includeContext,
>  boolean encodeResult, boolean forceAddSchemeHostAndPort, boolean escapeAmp
> )
> {noformat}
> ・/core/src/main/resources/template/simple/form-common.ftl
> {noformat}
> <#if parameters.action??>
>   action="${parameters.action?html}"<#rt/>
> </#if>
> {noformat}
> --------------------------------------------------------------------------------
> h3. Solution
> "escapeAmp" in method "DefaultUrlHelper.buildUrl" is set false. 
> My patch file is attached.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to