Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to forward request from servlet to action of struts2?

I want to forward a request from Servlet to Action like this using RequestDispacher like this

RequestDispatcher dispatcher=request.getRequestDispatcher("hello.action");
dispatcher.include(request, response);

It's not working. How can I resolve this problem?

like image 361
Sunil Avatar asked Apr 20 '13 11:04

Sunil


1 Answers

In order to do this you may also need to set the filter to run on FORWARD (and INCLUDE as your code shows, although you state you want a FORWARD):

<filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>REQUEST</dispatcher> 
  <dispatcher>FORWARD</dispatcher>
  <dispatcher>INCLUDE</dispatcher> <!-- If you want includes as well -->
</filter-mapping>
like image 120
Dave Newton Avatar answered Oct 14 '22 03:10

Dave Newton