added docs for RestfulActionMapper and Restful2ActionMapper
Content pulled from external source. Click | |
Content pulled from external source. Click | |
Possible uses of the ActionMapper include defining your own, cleaner namespaces, such as URLs like /person/1, which would be similar to a request to /getPerson.action?personID=1 using the DefaultActionMapper.
RestfulActionMapper
Content pulled from external source. Click
http://HOST/ACTION_NAME/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
This is the same as:
http://HOST/ACTION_NAME/ACTION_NAME + "Id"/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
Suppose for example we would like to display some articles by id at using the following URL sheme:
Your action just needs a setArticleId() method, and requests such as /article/1, /article/2, etc will all map
to that URL pattern.
|
Restful2ActionMapper
CompositeActionMapper
Content pulled from external source. Click
For example with the following in struts.properties :-
struts.mapper.class=org.apache.struts2.dispatcher.mapper.CompositeActionMapper
struts.mapper.composite.1=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
struts.mapper.composite.2=foo.bar.MyActionMapper
struts.mapper.composite.3=foo.bar.MyAnotherActionMapper
CompositeActionMapper will be configured with 3 ActionMapper, namely
"DefaultActionMapper", "MyActionMapper" and "MyAnotherActionMapper".
CompositeActionMapper would consult each of them in order described above.
|