|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.webwork.dispatcher.mapper.DefaultActionMapper
public class DefaultActionMapper
Default action mapper implementation, using the standard *.[ext] (where ext usually "action") pattern. The extension is looked up from the WebWork configuration key webwork.action.exection.
To help with dealing with buttons and other related requirements, this mapper (and otherActionMapper
s,
we hope) has the ability to name a button with some predefined prefix and have that button name alter the execution
behaviour. The four prefixes are:
<ww:form action="baz"> <ww:textfield label="Enter your name" name="person.name"/> <ww:submit value="Create person"/> <ww:submit name="method:anotherMethod" value="Cancel"/> </ww:form>Action prefix With action-prefix, instead of executing baz action's execute() method (by default if it isn't overriden in xwork.xml to be something else), the anotherAction action's execute() method (assuming again if it isn't overriden with something else in xwork.xml) will be executed.
<ww:form action="baz"> <ww:textfield label="Enter your name" name="person.name"/> <ww:submit value="Create person"/> <ww:submit name="action:anotherAction" value="Cancel"/> </ww:form>Redirect prefix With redirect-prefix, instead of executing baz action's execute() method (by default it isn't overriden in xwork.xml to be something else), it will get redirected to, in this case to www.google.com. Internally it uses ServletRedirectResult to do the task.
<ww:form action="baz"> <ww:textfield label="Enter your name" name="person.name"/> <ww:submit value="Create person"/> <ww:submit name="redirect:www.google.com" value="Cancel"/> </ww:form>Redirect-action prefix With redirect-action-prefix, instead of executing baz action's execute() method (by default it isn't overriden in xwork.xml to be something else), it will get redirected to, in this case 'dashboard.action'. Internally it uses ServletRedirectResult to do the task and read off the extension from the webwork.properties.
<ww:form action="baz"> <ww:textfield label="Enter your name" name="person.name"/> <ww:submit value="Create person"/> <ww:submit name="redirect-action:dashboard" value="Cancel"/> </ww:form>
Constructor Summary | |
---|---|
DefaultActionMapper()
|
Method Summary | |
---|---|
ActionMapping |
getMapping(HttpServletRequest request)
Return the ActionMapping for the given HttpServletRequest , the format of
HttpServletRequest url depends on the implementation of ActionMapper , eg. |
String |
getUriFromActionMapping(ActionMapping mapping)
Return the uri of the ActionMapping passed in as the argument. |
protected void |
handleSpecialParameters(HttpServletRequest request,
ActionMapping mapping)
Extension hook, that handle special parameters, namely those with prefix eg. |
protected void |
parseNameAndNamespace(String uri,
ActionMapping mapping)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultActionMapper()
Method Detail |
---|
public ActionMapping getMapping(HttpServletRequest request)
ActionMapper
ActionMapping
for the given HttpServletRequest
, the format of
HttpServletRequest
url depends on the implementation of ActionMapper
, eg.
a RestfulActionMapper
might handle it differently from
DefaultActionMapper
.
Implementation should return null if it cannot handle the format of request (eg. if it is bad etc.) such that
we could cascade ActionMapping
together using
CompositeActionMapper
getMapping
in interface ActionMapper
protected void handleSpecialParameters(HttpServletRequest request, ActionMapping mapping)
request
- mapping
- protected void parseNameAndNamespace(String uri, ActionMapping mapping)
public String getUriFromActionMapping(ActionMapping mapping)
ActionMapper
ActionMapping
passed in as the argument.
Implementation should return null if it cannot handle the format of request (eg. if it is bad etc.) such that
we could cascade ActionMapping
together using
CompositeActionMapper
The parameter mapping
is an instance of ActionMappingEx
.
getUriFromActionMapping
in interface ActionMapper
|
WebWork Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |