I haven't used the restful mappers at all, so I'm just guessing, but it
may be that you need to use prefix mapping instead of suffix mapping in
web.xml.
Either way, if you are going to use suffix mapping, the suffix would
always be the last thing in the URL (not including any query part that
is). You could try these posibilities:
http://localhost:8080/example/HelloWord/1.action
http://localhost:8080/example/HelloWord/id/1.action
but I would think if you want restful URLs, switching to prefix mapping
and getting rid of the .action suffix would be what you want anyway...
L.
Jordi Rubio Moreno wrote:
Hi,
I'm testing HelloWorld struts 2 example with friendly url's. I have read
http://struts.apache.org/2.0.6/docs/restfulactionmapper.html
http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/d
ispatcher/mapper/Restful2ActionMapper.htmlhttp://struts.apache.org/2.0.6
/docs/restfulactionmapper.html
(and a lot of pages found in Google speaking about Restful way)
and I don't understand what I'm doing wrong.
I have declared the HelloWord action as
<action name="HelloWorld/*" class="example.HelloWorld">
<param name="id">{1}</param>
<result>/HelloWorld.jsp</result>
</action>
using wildcards to pass parameters. The HelloWord class has an "id"
member variable, with it's public getters and setters.
The struts.properties has the next lines configurated:
struts.mapper.class=org.apache.struts2.dispatcher.mapper.Restful2ActionM
apper
struts.action.extension=action
struts.enable.DynamicMethodInvocation = false
struts.enable.SlashesInActionNames = true
(I have tested with RestfulActionMapper and DefaultActionMapper objects
too)
I have read all documentation sections that speak about URL syntax
(http://HOST/ACTION_NAME/PARAM_NAME1/PARAM_VALUE1/PARAM_NAME2/PARAM_VALU
E2, etc etc), but my example doesn't works. I have tried this
combinations:
http://localhost:8080/example/HelloWord.action/1
http://localhost:8080/example/HelloWord.action/id/1
http://localhost:8080/example/id/1/HelloWord.action
http://localhost:8080/example/1/HelloWord.action
always with the same result: There is no Action mapped for action name
blablabla/blablabla
Please, I need to understand what I'm doing wrong, because I believe I'm
doing the things as tutorials and articles show, but without right
results...
Thanks a lot!
Jordi Rubio Moreno
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]