Restful2ActionMapper does not process id when dynamic method is specified
-------------------------------------------------------------------------

                 Key: WW-2186
                 URL: https://issues.apache.org/struts/browse/WW-2186
             Project: Struts 2
          Issue Type: Bug
          Components: Dispatch
    Affects Versions: 2.0.9
         Environment: 2.0.9
struts.xml
...
<constant name="struts.mapper.idParameterName" value="objId"/>
...
<action name="customer/*" class="CustomerDataAction">
<result>/pages/listCustomer.jsp</result>
        <result name="view">/pages/viewCustomer.jsp</result>
</action>
...
            Reporter: Shane Frensley
            Priority: Minor


According to the Restful2ActionMapper javadoc this pattern should work:

GET:    /movie/Thrillers!edit => method="edit", id="Thrillers"

Using this pattern, the id never gets set. The reason is, that the action 
mapper only fixes up the id and actioname when the method specified is null 
(line 128).

I'm not sure what the plans are for this action mapper, but I really like it. I 
have temporarily fixed the issue (w/o understanding really very much about the 
design) with this patch:


c172: } else {
+173:                   if (idParameterName != null && lastSlashPos > -1) {
+174:                   String id = actionName.substring(lastSlashPos+1);
+175:                     
+176:                   if (mapping.getParams() == null) {
+177:                       mapping.setParams(new HashMap());
+178:                   }
+179:                   mapping.getParams().put(idParameterName, id);
+180:                   actionName = actionName.substring(0, lastSlashPos);
+181:         
+182:           }


Thanks for the great action mapper. I love it. 



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to