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

Double bang on form action

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.8
    • Fix Version/s: 2.3.12
    • Component/s: Core Actions
    • Labels:
      None
    • Environment:

      Centos Apache/tomcat with mod_jk

      Description

      Hello,

      I sometimes use the dynamic method invocation on the form action for submitting and have noticed for a while now, that there is a double bang on the compiled page:

      eg. If I use action="license!member" on the compiled page I get
      action="/events/license!member!member.action"

      on the jsp:

      <s:form action="license!member" >
      ..
      </s:form>

      gives:

      <form method="post" action="/events/license!member!member.action" id="license!member" name="license!member">
      ''
      </form>

      It only seems to be on the form tag though.

      Have traced it to DefaultActionMapper, line 539. It needs to check to make sure there is no bang already before adding another one, ie follow existing logic in other methods.

      if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) {
        uri.append("!").append(mapping.getMethod());
      }
      

      This seems to have fixed it:

      //if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) {
      //uri.append("!").append(mapping.getMethod());
      //}
      if (allowDynamicMethodCalls) {
      if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) {
      // handle "name!method" convention.
      name = mapping.getName();
      if (name.indexOf("!") == -1) {
      // Append the method as no bang found
      uri.append("!").append(mapping.getMethod());
      }
      }
      } else {
      if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) {
      uri.append("!").append(mapping.getMethod());
      }
      }
      

      I would do a patch but I have already modified the DefaultActionMappe for WW-1967 which has still hopefully outstanding.

      Cheers Greg.

        Attachments

        1. patch_WW-1967_WW-3965 .txt
          2 kB
          Greg Huber
        2. patch_WW-1967.txt
          1 kB
          Greg Huber
        3. patch_WW-3965 .txt
          1 kB
          Greg Huber

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              ghuber Greg Huber
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: