I added a filter in my struts 2 application. I am using this filter to check cookie values. If appropriate cookie is found then i want to redirect user to home page rather than normal login page. So for displaying home page I want to call struts 2 action associated with home page. I tried calling homepage.execute() method from filter, but this does not display the result(jsp page) associated with home page. Please suggest me some way to call homepage action from fiter class.
Asked
Active
Viewed 1,521 times
0
-
What is wrong with using the session? – Quaternion Aug 20 '11 at 23:37
1 Answers
2
I don't know what your requirements are, but usually using a Struts 2 interceptor is a better idea.
Anyway you can't invoke action directly from Java because it would not trigger the framework stuff. Instead you should consider to redirect to the mapped url of the action (for example: response.sendRedirect("http://your_host_name/your_action_name.action") )

Umesh Awasthi
- 23,407
- 37
- 132
- 204

Maurizio Cucchiara
- 895
- 6
- 11