Struts2 ActionContext and Response for chaining actions
posted 3 years ago
I have a pretty complex problem about struts2 chaining actions, thanks in advance for your patience reading my problem. I will try my best to describe it clearly.
Below is my struts.xml:
My logic is like this: When accessing to /myapp/test, TestAction1 will handle the request; In TestAction1, I "include" action x (my 2nd action in my config) like this:
And the important thing is I am using a customized ResponseIml when including "x.action".
After including, I return "success", so the result chains to action y (3rd action in my config);
And at last, TestAction2 continue to handle the request, it will go to success result, and the jspshould be rendered, but what I see is a blank page.
The jsp file is very simple: index.jsp
My question/puzzle is:
In TestAction1, if I get the response from ServletActionContext, I am getting different ones before and after including; before including is the default response, but after including I got an instance of my customized ResponseImpl; I expect to get the same one: i.e.: the default response;
In TestAction2, I get response from ServletActionContext, what I got is the instance of my customized ResponseIml;
I am getting a different ActionContext in TestAction2 (compared with the ActionContext I get in TestAction1).
This problem really drive me on the nuts, I have spent days on it.
Any advice will be appreciated!
Thanks a million!!
Please let me know if you need more info, thanks!!