Is there a way to configure struts 2, so that the dispatcher will use the query开发者_开发技巧string to map the action to invoke?
For example, in the link below, I would like to invoke action blah, not action foo.
http://domain:port/myapp/foo.do?someparameter=blah
Thanks.
I do not think that is possible with any of the default mappers.
It wouldn't be that bad to create an Interceptor
that is configured for your foo
action that checks the value of someparameter
, and either chains or redirects to your blah
action.
+1 Jeremy: That can do the magic else if you don't want to create an action just create a kinda dispatcher action which will dispatch your request to certain action based on the value of Query String
For e.g
Foo action execute();
if (querystring="test") {
setActionName("Test");
return "next";
}
Based on these control string, you can forward request to certain action.
<result name="next" type="redirectAction">${actionName}</result>
精彩评论