You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darren James <jd...@netflix.com> on 2008/01/23 04:20:28 UTC
including the output of an action execution in a servlet response.
Hi all,
I have a servlet that I want to include the result of a struts2 action
in the
response. I have a method that's called from my servlet's doGet method,
which does something along the lines of
.....
RequestDispatcher requestDisp =
getServletContext().getRequestDispatcher("/somepackage/ExampleAction.action");
requestDisp.include(request, response);
.....
When I invoke the action directly from the browser (i.e.
http://myhost/somePackage/ExampleAction.action ), it works
just fine. When trying to invoke the action out of the servlet with
RequestDispatcher.include(), I get a message in
the response where the output should be that reads
"The requested resource (/somePackage/ExampleAction.action) is not
available".
I can't find what's generating this message, and it's not clear to me
why my action isn't being invoked.
I'm fairly certain I'm doing something stupid, but it's not obvious to
me yet. Any ideas?
thanks in advance,
- Darren.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: including the output of an action execution in a servlet response.
Posted by Darren James <jd...@netflix.com>.
I finally found the answer for any that are interested. servlet filters
apparently don't
trigger (by default) on forwarded and included requests. I had to
change my filter url
mapping in web.xml to make the struts2 filter fire....
from:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
to:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
cheers,
- darren.
Darren James wrote:
> Hi all,
>
> I have a servlet that I want to include the result of a struts2 action
> in the
> response. I have a method that's called from my servlet's doGet method,
> which does something along the lines of
>
> .....
> RequestDispatcher requestDisp =
> getServletContext().getRequestDispatcher("/somepackage/ExampleAction.action");
>
> requestDisp.include(request, response);
> .....
>
>
> When I invoke the action directly from the browser (i.e.
> http://myhost/somePackage/ExampleAction.action ), it works
> just fine. When trying to invoke the action out of the servlet with
> RequestDispatcher.include(), I get a message in
> the response where the output should be that reads
>
> "The requested resource (/somePackage/ExampleAction.action) is not
> available".
>
> I can't find what's generating this message, and it's not clear to me
> why my action isn't being invoked.
> I'm fairly certain I'm doing something stupid, but it's not obvious to
> me yet. Any ideas?
>
> thanks in advance,
>
> - Darren.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org