Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4631

Empty <s:param name="p1" value=""/> is being supressed

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.28
    • Fix Version/s: 2.5.5
    • Component/s: Plugin - Tags
    • Labels:
      None

      Description

      I discovered a problem with the <s:param /> tag when attempting to pass an empty parameter.

      <s:url var="myUrl" action='MyAction'>
      <s:param name="p1" value=""/>
      <s:param name="p2"></s:param>
      </s:url>

      I was attempting to pass an empty parameter using the "p1" syntax above and the parameter was being suppressed.

      Using the "p2" syntax it works correctly, and the empty parameter is included.

      The doc http://struts.apache.org/docs/param.html says that "suppressEmptyParameters" defaults to false but the p1 parameter was always suppressed even if I added suppressEmptyParameters="false".

      Also the doc http://struts.apache.org/docs/param.html has an incorrect example on how to use the suppressEmptyParameters option.

      <s:param name="suppressEmptyParameters" value="true"/>

        Issue Links

          Activity

          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build Struts-JDK7-master #530 (See https://builds.apache.org/job/Struts-JDK7-master/530/)
          WW-4631: unified behavior for empty url parameters (cnenning: rev e7ce5dcc0dc576fe8081c66e17b57b30257af9f4)

          • (edit) core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java
          • (edit) core/src/main/java/org/apache/struts2/components/Param.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK7-master #530 (See https://builds.apache.org/job/Struts-JDK7-master/530/ ) WW-4631 : unified behavior for empty url parameters (cnenning: rev e7ce5dcc0dc576fe8081c66e17b57b30257af9f4) (edit) core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java (edit) core/src/main/java/org/apache/struts2/components/Param.java
          Hide
          cn42 Christoph Nenning added a comment -

          Cool! Did you port this to 2.3? If not, please remove 2.3.31 as fix version - it's time to stop doing such things

          Yes, you are right! Removed fix version 2.3.31.

          Show
          cn42 Christoph Nenning added a comment - Cool! Did you port this to 2.3? If not, please remove 2.3.31 as fix version - it's time to stop doing such things Yes, you are right! Removed fix version 2.3.31.
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Cool! Did you port this to 2.3? If not, please remove 2.3.31 as fix version - it's time to stop doing such things

          Show
          lukaszlenart Lukasz Lenart added a comment - Cool! Did you port this to 2.3? If not, please remove 2.3.31 as fix version - it's time to stop doing such things
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit e7ce5dcc0dc576fe8081c66e17b57b30257af9f4 in struts's branch refs/heads/master from cnenning
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=e7ce5dc ]

          WW-4631: unified behavior for empty url parameters

          Show
          jira-bot ASF subversion and git services added a comment - Commit e7ce5dcc0dc576fe8081c66e17b57b30257af9f4 in struts's branch refs/heads/master from cnenning [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=e7ce5dc ] WW-4631 : unified behavior for empty url parameters
          Hide
          cn42 Christoph Nenning added a comment -

          fixed

          Show
          cn42 Christoph Nenning added a comment - fixed
          Hide
          cn42 Christoph Nenning added a comment -

          Isn't related to WW-4628?

          Nope, is not related.

          As stated in documentation: the tag behaves differently when value is set either via value= attribute or via tag-body. Probably it was not intended to get different behavior for empty parameters.

          I changed to take suppressEmptyParameters into account when value is set via body as well. And I made sure empty parameters are included when set via value=.

          I also updated javadoc. There were other issues with it, too

          Show
          cn42 Christoph Nenning added a comment - Isn't related to WW-4628 ? Nope, is not related. As stated in documentation: the tag behaves differently when value is set either via value= attribute or via tag-body. Probably it was not intended to get different behavior for empty parameters. I changed to take suppressEmptyParameters into account when value is set via body as well. And I made sure empty parameters are included when set via value= . I also updated javadoc. There were other issues with it, too
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Isn't related to WW-4628?

          Show
          lukaszlenart Lukasz Lenart added a comment - Isn't related to WW-4628 ?

            People

            • Assignee:
              cn42 Christoph Nenning
              Reporter:
              glindholm Greg Lindholm
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development