[错误]:
在使用<c:import url="/MyHtml.html" context=”/sample2” var="thisPage"/>时,使用context指定了同一服务器下的另一个WebApp的资源时(即访问WEB_ROOT/sample2/MyHtml.html),出现如下错误提示:
javax.servlet.ServletException: javax.servlet.jsp.JspTagException: In URL tags, when the "context" attribute is specified, values of both "context" and "url" must start with "/".
完整的context.xml内容如下:
<!-- The contents of this file will be loaded for each web application -->
<Context crossContext="true">
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
</Context>
Tomcat文档中对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.