| Author |
how to share data between servlet in different webapplication
|
rehans oberoi
Ranch Hand
Joined: Dec 06, 2005
Posts: 174
|
|
servlet A receives a request that it forward to servlet B within another web application in the same web container servlet A need to share data with servlet B and data must be not visible to other servlets in A's web application in which object can the data that A shares with B be stored 1. http session 2.servletconfig 3.servletcontext 4httpservletrequest 5httpservletresponse hi ranchers please tell the answer according to me answer must be 4 or 5
|
 |
ramprasad madathil
Ranch Hand
Joined: Jan 24, 2005
Posts: 489
|
|
servlet A receives a request that it forward to servlet B within another web application in the same web container
It may not be that simple. You cannot forward outside your 'context'. You could ofcourse, always, redirect.
servlet A need to share data with servlet B
Date could be stored in 1. db 2. a serialized object You cannot store it in the standard servlet api objects, not even the context object. ram.
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Originally posted by ramprasad madathil: Data could be stored in 1. db 2. a serialized object
In addition you can redirect it from one to another in the URL, if its like parameter string.
|
 |
rehans oberoi
Ranch Hand
Joined: Dec 06, 2005
Posts: 174
|
|
hi which is the most suitable answer please tell
|
 |
rehans oberoi
Ranch Hand
Joined: Dec 06, 2005
Posts: 174
|
|
we can redirect it by httpservletrequest object so can it be appropriate
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Originally posted by rehans oberoi: which is the most suitable answer
It depends, what kind of data you want to share. If simple strings then you can use URL approach. Otherwise, db, serialized objects, ldap, web services, etc are other means of sharing data.
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
|
This thread might be helpful.
|
 |
Manoj Kumkumath
Ranch Hand
Joined: Dec 01, 2005
Posts: 71
|
|
|
I feel one option will be to use HttpURLConnection. From the first servlet wecan make a connection to second servlet using this class. Using HttpURLConnection will ensure that the communication is only between two Servlets and helps you two transfer the data without constraints.
|
<a href="http://www.goodoldmanoj.blogspot.com/" target="_blank" rel="nofollow">http://www.goodoldmanoj.blogspot.com/</a>
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: how to share data between servlet in different webapplication
|
|
|