Display struts2 action based on request, not path name

Is there a way to configure struts 2 so that the dispatcher uses the request to map the action to the call?

For example, in the link below, I would like to call the blah action, not the foo action.

http: // domain: port / myapp / foo.do? someparameter = blah

Thank.

+3
source share
2 answers

I do not think this is possible with any of the default layout cards.

It would be nice to create Interceptorone that is configured for your action foo, which checks the value someparameter, and either chains or redirects your action blah.

+4
source

+1 : , , ,

,

Foo action execute();

if (querystring="test") {
    setActionName("Test");
    return "next";
}

.

<result name="next" type="redirectAction">${actionName}</result>
+2

Source: https://habr.com/ru/post/1783937/


All Articles