1. 程式人生 > >Tomcat配置任意目錄下的Web應用程式

Tomcat配置任意目錄下的Web應用程式

2011年01月28日 21:16:00 閱讀數:20406
													<span class="tags-box artic-tag-box">
							<span class="label">標籤:</span>
															<a data-track-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;con&quot;:&quot;web&quot;}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=web&amp;t=blog" target="_blank">web																</a><a data-track-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;con&quot;:&quot;tomcat&quot;}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=tomcat&amp;t=blog" target="_blank">tomcat																</a><a data-track-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;con&quot;:&quot;servlet&quot;}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=servlet&amp;t=blog" target="_blank">servlet																</a><a data-track-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;con&quot;:&quot;path&quot;}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=path&amp;t=blog" target="_blank">path																</a><a data-track-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;con&quot;:&quot;class&quot;}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=class&amp;t=blog" target="_blank">class																</a><a data-track-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;con&quot;:&quot;瀏覽器&quot;}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=瀏覽器&amp;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;">&nbsp;&nbsp;&nbsp; 每一個</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>