aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
Author

How to share a context (Struts and servlet)

Andrei Antonescu
Ranch Hand

Joined: Jul 08, 2010
Posts: 75
Hello,
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
Greenhorn

Joined: Sep 21, 2007
Posts: 11
hi,

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

in servlets set the data::

request.getSession().setAttribute("data","content");


in struts 2 action class get the data:::

using ActionContext

ActionContext actionContext = ActionContext.getContext();
actionContext.getSession.get("data");

I hope it should work..

Thank you

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to share a context (Struts and servlet)
 
Similar Threads
Deploy struts app
Run Servlet on deployment
Database Connection Pooling initialization with dbcp
Loading two servlets at the startup?
Can't include other page content with RequestDispatcher.include()