Return-Path: Delivered-To: apmail-struts-commits-archive@locus.apache.org Received: (qmail 79669 invoked from network); 6 Dec 2008 04:53:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Dec 2008 04:53:58 -0000 Received: (qmail 36148 invoked by uid 500); 6 Dec 2008 04:54:10 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 36114 invoked by uid 500); 6 Dec 2008 04:54:09 -0000 Mailing-List: contact commits-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 commits@struts.apache.org Received: (qmail 36105 invoked by uid 99); 6 Dec 2008 04:54:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Dec 2008 20:54:09 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Dec 2008 04:52:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A3D4C23888A3; Fri, 5 Dec 2008 20:53:06 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r723948 - in /struts/struts2/trunk/core/src: main/java/org/apache/struts2/components/ServletUrlRenderer.java test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java test/resources/org/apache/struts2/views/jsp/ui/Formtag-23.txt Date: Sat, 06 Dec 2008 04:53:06 -0000 To: commits@struts.apache.org From: wesw@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081206045306.A3D4C23888A3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: wesw Date: Fri Dec 5 20:53:06 2008 New Revision: 723948 URL: http://svn.apache.org/viewvc?rev=723948&view=rev Log: ServletUrlRenderer patch to fix s:form tag when using dynamic method invocation. Per WW-2727 and WW-2768, thanks for the patch Lukasz Racon Added: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-23.txt (with props) Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java?rev=723948&r1=723947&r2=723948&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java Fri Dec 5 20:53:06 2008 @@ -131,10 +131,10 @@ String actionMethod = nameMapping.getMethod(); final ActionConfig actionConfig = formComponent.configuration.getRuntimeConfiguration().getActionConfig( - namespace, action); + namespace, actionName); if (actionConfig != null) { - ActionMapping mapping = new ActionMapping(action, namespace, actionMethod, formComponent.parameters); + ActionMapping mapping = new ActionMapping(actionName, namespace, actionMethod, formComponent.parameters); String result = UrlHelper.buildUrl(formComponent.actionMapper.getUriFromActionMapping(mapping), formComponent.request, formComponent.response, null); formComponent.addParameter("action", result); @@ -153,14 +153,14 @@ // if the name isn't specified, use the action name if (formComponent.name == null) { - formComponent.addParameter("name", action); + formComponent.addParameter("name", actionName); } // if the id isn't specified, use the action name - if (formComponent.getId() == null && action!=null ) { - formComponent.addParameter("id", formComponent.escape(action)); + if (formComponent.getId() == null && actionName!=null ) { + formComponent.addParameter("id", formComponent.escape(actionName)); } - } else if (action != null) { + } else if (actionName != null) { // Since we can't find an action alias in the configuration, we just // assume the action attribute supplied is the path to be used as // the URI this form is submitting to. @@ -168,10 +168,10 @@ // Warn user that the specified namespace/action combo // was not found in the configuration. if (namespace != null) { - LOG.warn("No configuration found for the specified action: '" + action + "' in namespace: '" + namespace + "'. Form action defaulting to 'action' attribute's literal value."); + LOG.warn("No configuration found for the specified action: '" + actionName + "' in namespace: '" + namespace + "'. Form action defaulting to 'action' attribute's literal value."); } - String result = UrlHelper.buildUrl(action, formComponent.request, formComponent.response, null); + String result = UrlHelper.buildUrl(actionName, formComponent.request, formComponent.response, null); formComponent.addParameter("action", result); // namespace: cut out anything between the start and the last / Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java?rev=723948&r1=723947&r2=723948&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java Fri Dec 5 20:53:06 2008 @@ -67,6 +67,22 @@ verify(FormTag.class.getResource("Formtag-9.txt")); } + + public void testFormWithActionAttributeContainingBothActionAndDMIMethod() throws Exception { + FormTag tag = new FormTag(); + tag.setPageContext(pageContext); + tag.setName("myForm"); + tag.setMethod("post"); + tag.setAcceptcharset("UTF-8"); + tag.setAction("testAction!testMethod"); + tag.setEnctype("myEncType"); + tag.setTitle("mytitle"); + tag.setOnsubmit("submitMe()"); + tag.doStartTag(); + tag.doEndTag(); + + verify(FormTag.class.getResource("Formtag-23.txt")); + } public void testFormWithFocusElement() throws Exception { FormTag tag = new FormTag(); Added: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-23.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-23.txt?rev=723948&view=auto ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-23.txt (added) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-23.txt Fri Dec 5 20:53:06 2008 @@ -0,0 +1,4 @@ +
+ +
+
Propchange: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-23.txt ------------------------------------------------------------------------------ svn:eol-style = native