wood burning stoves*
The moose likes Servlets and the fly likes How to send values from one Servlet Context to other Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to send values from one Servlet Context to other" Watch "How to send values from one Servlet Context to other" New topic
Author

How to send values from one Servlet Context to other

Vasantha Prabha
Ranch Hand

Joined: Oct 02, 2003
Posts: 108
Heyy Can any one tell me that How can I send values from one servletContext to other?.
Regards,
Vasantha


Regards,Vasantha<p>Great minds discuss ideas. Average minds discuss events. Small minds discuss people.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
not directly, and for good reasons (mainly security).
There's several indirect ways:
- write a file with the data and check in the other application whether the file is there, if so read and delete.
- send HTTP requests back and forth
- use some other means of network communication


42
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
To switch between web application contexts (in the same container) you need to call getcontext()method of servletcontext. That is -
getServletContext().getContext("\app2").
[ March 22, 2004: Message edited by: Varun Khanna ]

- Varun
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
In a security conscious environment, the servlet container may return null for a given URL.

Not guaranteed to work, and in fact I'd recommend any servlet container disabling it by default as it is a potential serious security problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to send values from one Servlet Context to other