The documentation was pretty misleading, I wasted a few hours just chasing stuff on the web, in the end it came down to just stepping through the code.
I tried to get the convention plugin working first but could not work out how to get that to work with my application although I never looked at the code for that. I am surprised that the REST stuff is quite low key with struts2, or that is the way it seems to me, it really is a make or break for my application/site as the URLs will need to get favourably viewed by google for it to work out. I am quite happy to knock up a small test app and write a doc on this for the WIKI. Can I just apply for a 'CLA'? David > Date: Fri, 8 May 2009 14:13:02 -0400 > Subject: Re: Problems setting attributes on my Action using > Restful2ActionMapper > From: musa...@gmail.com > To: user@struts.apache.org > > That part has always lacked good documentation. I have never used > myself so I have no idea how it works. You can submit a CLA and get > edit right to the wiki. > > musachy > > On Fri, May 8, 2009 at 1:00 PM, David Rocks <rocks_da...@hotmail.com> wrote: > > > > 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 > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > _________________________________________________________________ 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