I have a J2ee application where I basically want two objects, created by two separate servlets to communicate directly and I need these intances to be stable, i.e. to "know" each other during the session.
The sequence is roughly:
- Client sends a request to Servlet #1, which creates object A
- Client sends a second request (after the first returns) to servlet #2 which creates object B.
- Object B finds A, using JNDI, and the two objects interact.
- The client now continues to send requests to object A which needs to find B again.
How do I make sure that these two instances know each throughout the session? Binding them to JNDI doesn't entirely solve the problem, since object B needs to communicate with its original servlet (servlet #2), which is not kept stable across requests.
Any ideas?
Thanks in advance.