随笔 - 117  文章 - 72  trackbacks - 0

声明:原创作品(标有[原]字样)转载时请注明出处,谢谢。

常用链接

常用设置
常用软件
常用命令
 

订阅

订阅

留言簿(7)

随笔分类(130)

随笔档案(123)

搜索

  •  

积分与排名

  • 积分 - 152530
  • 排名 - 390

最新评论

[标题]:Tomcat crossContext
[时间]:2009-6-1
[摘要]:当<c:import >指定了context属性时,应该设置%TOMCAT_HOME%/conf/context.xml的Context中的属性crossContext="true"。
[关键字]:context、tag、crossContext、JSP、Servlet
[环境]:Tomcat 6、Window XP SP3
[作者]:Winty (wintys@gmail.com) http://www.blogjava.net/wintys

[错误]:
    在使用<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 "/".

[原因]:
    Tomcat默认不能跨WebApp进行访问。

[解决]:
    %TOMCAT_HOME%/conf/context.xml的Context中的属性crossContext="true"。

    完整的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.

[参考资料]:
%TOMCAT_HOME%/webapps/docs/config/context.html

posted on 2009-06-01 12:27 天堂露珠 阅读(3615) 评论(1)  编辑  收藏 所属分类: JSP

FeedBack:
# re: [原]Tomcat crossContext 2009-06-02 13:38 找个美女做老婆
我的blog有了一个新家 http://www.javaly.cn  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: