Thanks for your reply. It was quite helpful. But my requirement is little changed now. Using Servlet context i can not get the session synchronization between two app because of some security issues. Please can you suggest me the best way of getting session synchronization between two app.
I have a link in my page. As i click on that link my application get an attribute from from other app running on same server. But that attribute is set on application level on other application. so now the problem is if a user(same session) try to access my application on different timing, he will get different value of attribute because that attribute is dynamic with time. But i want a unique value for a user.
So now i have decided that i will use a Map or Hashtable to store a session id as key and attribute as value. So that every user would get a unique attribute. This is my idea. Can you suggest me is there any drawback in my approach related to seurity or performance something.
So there will be one value for each user, and that value should be unique across different web apps running on the same server? Where does this value come from, and how often does it change? Could it be stored in the DB along with all the other user information, so that all web apps can get at it?
Sorry for late reply. Actually today i have discussed things with my PM. My task is little extended. I can not work on session ids. What i have to perform now is if a user log in from another browser then he or she should be in same session as he was in previous browser on the same application.
I mean to say is that a user is access the page and that page have an attribute value which is dynamic with time. Now problem is if the same user access the same page(after some time) by typing URL path of that page on different browser then he should be getting the same attribute value as it was previously.
By default we we log in our application from another browser then it logged in other session. So is there any technique to perform it?. Any suggestion regarding this? Thanks in advance.
Thanks to all for your reply. My previous task is finished. Now my task is little more extended. Now i have been instructed that one of my application is deployed on one machine and i have to access its context in another app deployed on another server. So i think now i will have to use JNDI.
Since i had done some work on EJB with JBoss where we use JNDI and we bind HomeInterface to JNDI logical name and by that name we access that Home Interface in the code.
Here is that JNDI Code:
Here we can give the ip(in place of localhost) of web server.
In the same way now i will have to bind the servlet context of on application to JNDI Logical name. And through that name i will access the servlet context in another app deployed on another server. But now the problem is I m not getting sufficient coding based help from anywhere. Please can anybody provide me any of type help on this topic. Thanks in advance.
Out of curiosity..
Why are you spreading things out over multiple web applications?
This is one area where the servlet spec (I haven't finished the spec for 3.0 so this might have changed) is not very specific.
Not specific means that behavior tends to be different from app server to app server, meaning that your app is not going to be very portable.