web.xml
----------------
<taglib>
<taglib-uri>http://localhost/sample.tld</taglib-uri>
<taglib-location>/WEB-INF/jsptags/sampleLib.tld</taglib-location>
</taglib>
In a security conscious environment, the servlet container may return null for a given URL.
try{
ServletContext rootContext = getServletContext().getContext("http://localhost:8080/");
System.out.println( ( rootContext.getAttribute("root") ).toString() );
}catch(Exception e){
System.out.println(e);
}
To illustrate this requirement with an example: if a servlet uses the RequestDispatcher to call a servlet in another web application, any sessions created for and visible to the callee servlet must be different from those visible to the calling servlet.