wood burning stoves*
The moose likes Struts and the fly likes How to share a context (Struts and servlet) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to share a context (Struts and servlet)" Watch "How to share a context (Struts and servlet)" New topic

How to share a context (Struts and servlet)

Andrei Antonescu
Ranch Hand

Joined: Jul 08, 2010
Posts: 75
I have a application coded in Struts. I want to install a servlet on the same app that has

Is there any way to send data from the Servlet to a method called in the Struts portion of the app?
I have tried (in the servlet):

And in the struts action:

with no luck.

Thanks in advance
Krishna Madhava

Joined: Sep 21, 2007
Posts: 11

you can share the data between servlets and struts like below...

in servlets set the data::


in struts 2 action class get the data:::

using ActionContext

ActionContext actionContext = ActionContext.getContext();

I hope it should work..

Thank you

It is sorta covered in the JavaRanch Style Guide.
subject: How to share a context (Struts and servlet)
Similar Threads
Can't include other page content with RequestDispatcher.include()
Loading two servlets at the startup?
Deploy struts app
Run Servlet on deployment
Database Connection Pooling initialization with dbcp