隨筆 - 117  文章 - 72  trackbacks - 0

          聲明:原創作品(標有[原]字樣)轉載時請注明出處,謝謝。

          常用鏈接

          常用設置
          常用軟件
          常用命令
           

          訂閱

          訂閱

          留言簿(7)

          隨筆分類(130)

          隨筆檔案(123)

          搜索

          •  

          積分與排名

          • 積分 - 156285
          • 排名 - 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.aygfsteel.com/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 天堂露珠 閱讀(3636) 評論(1)  編輯  收藏 所屬分類: JSP

          FeedBack:
          # re: [原]Tomcat crossContext 2009-06-02 13:38 找個美女做老婆
          我的blog有了一個新家 http://www.javaly.cn  回復  更多評論
            
          主站蜘蛛池模板: 霍林郭勒市| 故城县| 上饶县| 永川市| 东光县| 泰安市| 乐亭县| 长宁区| 青海省| 垦利县| 扶余县| 尼勒克县| 汝南县| 肇东市| 咸丰县| 昌都县| 志丹县| 商洛市| 祥云县| 牡丹江市| 平顺县| 中阳县| 蛟河市| 伽师县| 鹿邑县| 广丰县| 和静县| 驻马店市| 赤峰市| 荆门市| 汉沽区| 白玉县| 上杭县| 方山县| 滨州市| 叶城县| 洪洞县| 平昌县| 左贡县| 渭南市| 久治县|