Tomcat配置任意目錄下的Web應用程式
阿新 • • 發佈:2018-12-11
2011年01月28日 21:16:00
zhenyusoso
閱讀數:20406
<span class="tags-box artic-tag-box"> <span class="label">標籤:</span> <a data-track-click="{"mod":"popu_626","con":"web"}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=web&t=blog" target="_blank">web </a><a data-track-click="{"mod":"popu_626","con":"tomcat"}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=tomcat&t=blog" target="_blank">tomcat </a><a data-track-click="{"mod":"popu_626","con":"servlet"}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=servlet&t=blog" target="_blank">servlet </a><a data-track-click="{"mod":"popu_626","con":"path"}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=path&t=blog" target="_blank">path </a><a data-track-click="{"mod":"popu_626","con":"class"}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=class&t=blog" target="_blank">class </a><a data-track-click="{"mod":"popu_626","con":"瀏覽器"}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=瀏覽器&t=blog" target="_blank">瀏覽器 </a> <span class="article_info_click">更多</span></span> <div class="tags-box space"> <span class="label">個人分類:</span> <a class="tag-link" href="https://blog.csdn.net/zhenyusoso/article/category/659460" target="_blank">讀書筆記 </a> </div> </div> <div class="operating"> </div> </div> </div> </div> <article> <div id="article_content" class="article_content clearfix csdn-tracking-statistics" data-pid="blog" data-mod="popu_307" data-dsm="post"> <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-e2445db1a8.css"> <div class="htmledit_views"> <p><span style="font-family:'宋體';font-size:12pt;"> 每一個</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Web</span><span style="font-family:'宋體';font-size:12pt;">應用程式都有一個起始目錄,在開發和部署</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Web</span><span style="font-family:'宋體';font-size:12pt;">應用程式時,通過上下文路徑(</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Context path</span><span style="font-family:'宋體';font-size:12pt;">)來區分不同的</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Web</span><span style="font-family:'宋體';font-size:12pt;">應用程式。</span><span style="text-decoration:underline;"><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Tomcat</span><span style="font-family:'宋體';font-size:12pt;">預設的</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Web</span><span style="font-family:'宋體';font-size:12pt;">應用程式的起始目錄(也稱為上下文根)是</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">%CATALINA_HOME%/webapps/ROOT</span><span style="font-family:'宋體';font-size:12pt;">,例如一個關於</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Hello World</span><span style="font-family:'宋體';font-size:12pt;">的</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Web</span><span style="font-family:'宋體';font-size:12pt;">應用程式的起始目錄是</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">%CATALINA_HOME%/webapps/ch08</span><span style="font-family:'宋體';font-size:12pt;">,這就意味著</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">/ch08</span><span style="font-family:'宋體';font-size:12pt;">是關於</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Hello World</span><span style="font-family:'宋體';font-size:12pt;">的</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Web</span><span style="font-family:'宋體';font-size:12pt;">應用程式的上下文路徑。</span></span><span style="font-family:'宋體';font-size:12pt;">那麼如何配置任意目錄下的</span><span style="font-family:'Times New Roman';font-size:12pt;" lang="en-us" xml:lang="en-us">Web</span><span style="font-family:'宋體';font-size:12pt;">應用程式呢?</span></p>