隨筆 - 117  文章 - 72  trackbacks - 0

          聲明:原創(chuàng)作品(標(biāo)有[原]字樣)轉(zhuǎn)載時(shí)請(qǐng)注明出處,謝謝。

          常用鏈接

          常用設(shè)置
          常用軟件
          常用命令
           

          訂閱

          訂閱

          留言簿(7)

          隨筆分類(lèi)(130)

          隨筆檔案(123)

          搜索

          •  

          積分與排名

          • 積分 - 156289
          • 排名 - 390

          最新評(píng)論

          [標(biāo)題]:Tomcat crossContext
          [時(shí)間]:2009-6-1
          [摘要]:當(dāng)<c:import >指定了context屬性時(shí),應(yīng)該設(shè)置%TOMCAT_HOME%/conf/context.xml的Context中的屬性crossContext="true"。
          [關(guān)鍵字]:context、tag、crossContext、JSP、Servlet
          [環(huán)境]:Tomcat 6、Window XP SP3
          [作者]:Winty (wintys@gmail.com) http://www.aygfsteel.com/wintys

          [錯(cuò)誤]:
              在使用<c:import url="/MyHtml.html" context=”/sample2” var="thisPage"/>時(shí),使用context指定了同一服務(wù)器下的另一個(gè)WebApp的資源時(shí)(即訪(fǎng)問(wèn)WEB_ROOT/sample2/MyHtml.html),出現(xiàn)如下錯(cuò)誤提示:
          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默認(rèn)不能跨WebApp進(jìn)行訪(fǎng)問(wèn)。

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

              完整的context.xml內(nèi)容如下:
          <!-- 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文檔中對(duì)crossContext的說(shuō)明: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) 評(píng)論(1)  編輯  收藏 所屬分類(lèi): JSP

          FeedBack:
          # re: [原]Tomcat crossContext 2009-06-02 13:38 找個(gè)美女做老婆
          我的blog有了一個(gè)新家 http://www.javaly.cn  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 乐山市| 辽中县| 金昌市| 贵港市| 和平县| 平武县| 木兰县| 武邑县| 自贡市| 延长县| 行唐县| 讷河市| 云和县| 武宁县| 龙泉市| 乌兰察布市| 德钦县| 弥渡县| 桐柏县| 盱眙县| 珲春市| 赞皇县| 鹤庆县| 大余县| 定兴县| 洞口县| 集安市| 冕宁县| 凉城县| 石泉县| 辽阳县| 中超| 抚顺县| 雅安市| 定远县| 钦州市| 泸水县| 盐亭县| 绵阳市| 桂平市| 清丰县|