You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Greg Huber (JIRA)" <ji...@apache.org> on 2013/01/16 17:54:13 UTC

[jira] [Created] (WW-3965) Double bang on form action

Greg Huber created WW-3965:
------------------------------

             Summary: Double bang on form action
                 Key: WW-3965
                 URL: https://issues.apache.org/jira/browse/WW-3965
             Project: Struts 2
          Issue Type: Bug
          Components: Core Actions
    Affects Versions: 2.3.8
         Environment: Centos Apache/tomcat with mod_jk
            Reporter: Greg Huber
            Priority: Minor


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.

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

This seems to have fixed it:

{code:java}
//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());
}
}
{code}

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

Cheers Greg.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira