Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet problem

 
dx wu
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet A received a request that it forwards to Servlet B within anthor web application in the same web container . Servlet A needs to share data with Servlet B and that data must not be visible to other servlet in the A's web application.

in whici object can the data that A shares with B be stored?
A.HttpSession
B.ServletConfig
C.ServletConext
D.HttpServletRequest
E.HttpServletResponse

and i think the answer is ServletConfig, Cloud someone tell me is it correct?
thanks
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think it is HttpServletRequest. As you passing a request to the Sevlet to different web application, you can not share information through HttpSession, ServletConfig or ServletContext. The Data in HttpServletRequest is available to that request only and if you are not passing this request parameter to any other Servlet/JSP in A's web application, this information will not available to them.

Thanks
[ May 09, 2005: Message edited by: Narendra Dhande ]
 
dx wu
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you!
 
Anand Wadhwani
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Narendra,


I think it is HttpServletRequest. As you passing a request to the Sevlet to different web application, you can not share information through HttpSession


Session CAN be used across multiple applications within same web container as long as request is same. However, this is an incorrect answer in the above question because other servlets should not be able to see data.

Please confirm my understanding. Thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic