You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Don Brown (JIRA)" <ji...@apache.org> on 2007/09/21 09:30:37 UTC

[jira] Updated: (WW-2186) Restful2ActionMapper does not process id when dynamic method is specified

     [ https://issues.apache.org/struts/browse/WW-2186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown updated WW-2186:
--------------------------

    Fix Version/s: 2.0.11

> 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
>             Fix For: 2.0.11
>
>
> 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.