• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maintaining details while navigating between Applications

 
Rhea Karnam
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
Rhea.
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try saving ur values in ServletContext
cheers
Praful
 
Max Haroot
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic