Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8445710E4B for ; Tue, 17 Dec 2013 06:48:15 +0000 (UTC) Received: (qmail 22639 invoked by uid 500); 17 Dec 2013 06:48:11 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 22532 invoked by uid 500); 17 Dec 2013 06:48:09 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 22512 invoked by uid 99); 17 Dec 2013 06:48:08 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Dec 2013 06:48:08 +0000 Date: Tue, 17 Dec 2013 06:48:07 +0000 (UTC) From: "Yorozuya Kazuyuki (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (WW-4259) Parameter is NULL when using URL contains querystring consisted of some fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-4259?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:all-tabpanel ] Yorozuya Kazuyuki updated WW-4259: ---------------------------------- Description:=20 h3. Phenomenon 1. Submitting form with parameters using URL contains querystring consisted= of some fields. {noformat} {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=3D"Test.action?field1=3Dvalue1&amp;field2=3Dvalue2" {noformat} Due to duplication of "amp;", it causes field2 member to fail to recieve va= lue. therefore, field2 member equals NULL always. =20 \\ Desired result 2. is this. {noformat} action=3D"Test.action?field1=3Dvalue1&field2=3Dvalue2" {noformat} \\ h3. Cause Character entity reference about "&" is executed twice. Executed points are as follow. ---------------------------------------------------------------------------= ----- =E3=83=BB/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper= .java {noformat} String buildUrl( String action, HttpServletRequest request, HttpServletResponse response,= =20 Map params, String scheme, boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort, boolean escapeAmp ) {noformat} =E3=83=BB/core/src/main/resources/template/simple/form-common.ftl {noformat} <#if parameters.action??> action=3D"${parameters.action?html}"<#rt/> {noformat} ---------------------------------------------------------------------------= ----- h3. Solution "escapeAmp" in method "DefaultUrlHelper.buildUrl" is set false.=20 My patch file is attached. was: h3. Phenomenon 1. Submitting form with parameters using URL contains querystring consisted= of some fields. {noformat} {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=3D"Test.action?field1=3Dvalue1&amp;field2=3Dvalue2" {noformat} Due to duplication of "amp;", it causes field2 member to fail to recieve va= lue. therefore, field2 member equals NULL always. =20 \\ Desired result 2. is this. {noformat} action=3D"Test.action?field1=3Dvalue1&field2=3Dvalue2" {noformat} \\ h3. Cause Character entity reference about "&" is executed twice. Executed points are as follow. ---------------------------------------------------------------------------= ----- =E3=83=BB/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper= .java {noformat} String buildUrl( String action, HttpServletRequest request, HttpServletResponse response,= =20 Map params, String scheme, boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort, boolean escapeAmp ) {noformat} =E3=83=BB/core/src/main/resources/template/simple/form-common.ftl {noformat} <#if parameters.action??> action=3D"${parameters.action?html}"<#rt/> {noformat} ---------------------------------------------------------------------------= ----- h3. Solution "escapeAmp" in method "DefaultUrlHelper.buildUrl" is set "false."=20 patch file is this. {noformat} --- core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.jav= a.orig=092013-12-16 20:39:46.877161793 +0900 +++ core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.jav= a=092013-12-16 19:41:56.000000000 +0900 @@ -162,7 +162,7 @@ =20 =09=09=09ActionMapping mapping =3D new ActionMapping(actionName, namespace= , actionMethod, formComponent.parameters); =09=09=09String result =3D urlHelper.buildUrl(formComponent.actionMapper.g= etUriFromActionMapping(mapping), - formComponent.request, formComponent.response, actionP= arams, null, formComponent.includeContext, true); + formComponent.request, formComponent.response, actionP= arams, null, formComponent.includeContext, true, false, false); =09=09=09formComponent.addParameter("action", result); =20 =09=09=09// let's try to get the actual action class and name {noformat} > Parameter is NULL when using URL contains querystring consisted of some f= ields > -------------------------------------------------------------------------= ----- > > 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 > Fix For: 2.3.17 > > Attachments: ServletUrlRenderer.java.patch > > > h3. Phenomenon > 1. Submitting form with parameters using URL contains querystring consist= ed of some fields. > {noformat} > > {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=3D"Test.action?field1=3Dvalue1&amp;field2=3Dvalue2" > {noformat} > Due to duplication of "amp;", it causes field2 member to fail to recieve = value. > therefore, field2 member equals NULL always. > =20 > \\ > Desired result 2. is this. > {noformat} > action=3D"Test.action?field1=3Dvalue1&field2=3Dvalue2" > {noformat} > \\ > h3. Cause > Character entity reference about "&" is executed twice. > Executed points are as follow. > -------------------------------------------------------------------------= ------- > =E3=83=BB/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelp= er.java > {noformat} > String buildUrl( > String action, HttpServletRequest request, HttpServletResponse response,= =20 > Map params, String scheme, boolean includeContext, > boolean encodeResult, boolean forceAddSchemeHostAndPort, boolean escapeA= mp > ) > {noformat} > =E3=83=BB/core/src/main/resources/template/simple/form-common.ftl > {noformat} > <#if parameters.action??> > action=3D"${parameters.action?html}"<#rt/> > > {noformat} > -------------------------------------------------------------------------= ------- > h3. Solution > "escapeAmp" in method "DefaultUrlHelper.buildUrl" is set false.=20 > My patch file is attached. -- This message was sent by Atlassian JIRA (v6.1.4#6159)