Hi,

 

managed to get this kind of working although I am constrained to callin in my 
action the the names of the methods hard coded in the Restful2ActionMapper 
class.

 

Firstly I have to set...

 

struts.mapper.alwaysSelectFullNamespace=false 
struts.mapper.idParameterName=entityName  <-- the name of the parameter to be 
set in the action class

 

Also the documentation is wrong, it is not

 

 http://HOST/ACTION_NAME/PARAM_NAME1/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2

 

but

 

 http://HOST/PARAM_NAME2/PARAM_VALUE2/ACTION_NAME/PARAM_VALUE1

 

In the ACTION_NAME part I cannot set the action and the method name, i just 
have to set the action name and it picks up the view method.

 

so it has to be

 

http://127.0.0.1:8080/myApp/region/England -> that goes to view and puts the 
value of england into entityName  as shown above

 

I cannot force it to go to a get method like

 

http://127.0.0.1:8080/myApp/region/get/England   -> which calls get and sets 
entityName  

 

I would be quite happy to set @action( "region/get" ) on my action method.

 

So the docs could be updated and if someone knows how to set the method and 
action name in a rest URL using Restful2ActionMapper  then I am all ears.

 

Thanks

 

David

 

 
> From: rocks_da...@hotmail.com
> To: user@struts.apache.org
> Subject: Problems setting attributes on my Action using Restful2ActionMapper
> Date: Thu, 7 May 2009 15:40:30 +0000
> 
> 
> Hi,
> 
> 
> I am trying to work out how populate attributes on using Restful2ActionMapper 
> but I think I am missing something in my configuration and wondered if 
> someone could give me some advice.
> 
> 
> My struts file is
> 
> 
> <struts>
> <constant name="struts.mapper.class" value="restful2" /> 
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" /> 
> <constant name="struts.enable.SlashesInActionNames" value="true" />
> <constant name="struts.convention.package.locators" value="action" /> 
> 
> 
> <package name="default" extends="struts-default">
> 
> 
> <action name="region/*" class="com.action.RegionAction" >
> <param name="name">{0}</param>
> </action>
> </struts>
> 
> 
> My action
> 
> package com.action ;
> 
> @Results({
> @Result(name="get", location="region/displayRegion.jsp") 
> })
> public class RegionAction extends ActionSupport {
> 
> 
> private String name ;
> private int id ;
> 
> 
> public String get(){
> ….. 
> return "get" ;
> }
> 
> 
> // name & id getters and setters …...
> } 
> 
> 
> I am trying to get the URL into the state like as the documentation claims it 
> can handle
> 
> 
> http://HOST/ACTION_NAME/PARAM_NAME1/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
> 
> 
> So My URL would be like...
> 
> 
> http://127.0.0.1:8080/region/name/Mexico/id/2
> 
> 
> But that is not working out. Is there something I have missed?
> 
> 
> Many thanks
> 
> 
> _________________________________________________________________
> Hotmail® has a new way to see what's up with your friends.
> http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009

_________________________________________________________________
Hotmail® has a new way to see what's up with your friends.
http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009

Reply via email to