0

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.

Roman C
  • 49,761
  • 33
  • 66
  • 176
Harsh
  • 1
  • 2

1 Answers1

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