This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Servlets and the fly likes A Question in ServletContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "A Question in ServletContext" Watch "A Question in ServletContext" New topic
Author

A Question in ServletContext

Vasantha Prabha
Ranch Hand

Joined: Oct 02, 2003
Posts: 108
Can any one tell me why do we need
Context.getContext()
Regards,
Sangeetha


Regards,Vasantha<p>Great minds discuss ideas. Average minds discuss events. Small minds discuss people.
Kevin Jones
Author
Ranch Hand

Joined: Oct 29, 2003
Posts: 39
The getContext method takes a string. This is the URI to a different ServletContext running within this container. Once you have this reference you can then call getRequestDispatcher on that context and dispatch requests to servlets running in other web apps. Now,
i) this is probably not a good idea
ii) Containers may prevent this for security reasons


Kevin Jones<br />Author: <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0321136497/jranch-20" target="_blank" rel="nofollow">Servlets and JSP: The J2EE Web Tier</a>
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
that means you wanna access a resource beneath another application.
be careful when you are doing do.
hope that helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A Question in ServletContext