<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" x mlValidation="false">
<Context path="/项目A" reloadable="false" crossContext="true"></Context>
<Context path="/项目B" reloadable="false" crossContext="true"></Context>
</Host>
注意 crossContext 属性在帮助文档中意思
crossContext: Set to true if you want calls within this application to ServletContext.getContext() to successfully return a request dispatcher for other web applications running on this virtual host. Set to false (the default) in security conscious environments, to make getContext() always return null.
设置为true 说明你可以调用另外一个WEB应用程序 通过ServletContext.getContext() 获得ServletContext 然后再调用其getattribute() 得到你要的对象.