File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Maintaining details while navigating between Applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Maintaining details while navigating between Applications" Watch "Maintaining details while navigating between Applications" New topic

Maintaining details while navigating between Applications

Rhea Karnam

Joined: May 06, 2003
Posts: 21
Hi All,
I have two applications that are supposed to interact with each other.
So, when servlet1 of Application1 redirects a request to servlet2 (of Application 2), servlet2 parses the request url and behaves as expected. But, when servlet2 2 redirects back to servlet1 subsequently, I expect servlet1 to continue from where it was (before the request was redirected to servlet2). For this, I can guess that I need to save the details in the session. But, as I am navigating between Applciations, the values in the session are lost when I get back to Applciation 1.
Here are my doubts:
1. is my approach of saving details in the session and expecting to retrieve them back, ok?
2. to keep the session intact, what should I do?
3. is this where Serializing comes in?
Also, the requirement is that I can't encode the url to provide me these values, instead of using the session.
Can someone help me with this problem or guide me to some websites or books that can clear my doubts? Even help with keywords for google would be appreciated (The keyword combinations that I cud think of didn't help me)
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 642
Try saving ur values in ServletContext

All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Max Haroot

Joined: Jun 11, 2003
Posts: 3
A RequestDispatcher can be used to include the response from another context(application2) as long as both contexts are on the same server.
It will then continue in servlet1, appliction1 like you want.

(in application1, servlet1)
...some code...
RequestDispatcher reqDisp=request.getServletContext().getNamedDispatcher("servlet2Name"); //as named in web.xml <servlet-name>
reqDisp.include(request,response); //will include response from application2, servlet2
...some more code...
I agree. Here's the link:
subject: Maintaining details while navigating between Applications
It's not a secret anymore!