引用: http://topic.csdn.net/u/20080111/22/75ef5234-1def-43da-956a-8e701ba113bf.html
目標:
我在$tomcat/webapps/下建了個myjsp目錄作為我網站的默認目錄,在myjsp中有一個a.jsp文件,該文件要作為我網站的默認主頁。
修改配置文件:
首先,修改$tomcat/conf/server.xml文件。
在server.xml文件中,有一段如下:
……
<engine name="Catalina" defaultHost="localhost">
? <host name="localhost" appBase="webapps"
? unpackWARs="true" autoDeploy="true"
? xmlValidation="false" xmlNamespaceAware="false">
? ……
? <host>
</engine>
……
在<host></host>標簽之間添加上:
<Context path="" docBase="myjsp" debug="0" reloadable="true" />
path是說明虛擬目錄的名字,如果你要只輸入ip地址就顯示主頁,則該鍵值留為空;
docBase是虛擬目錄的路徑,它默認的是$tomcat/webapps/ROOT目錄,現在我在webapps目錄下建了一個myjsp目錄,讓該目錄作為我的默認目錄。
debug和reloadable一般都分別設置成0和true。
然后,修改$tomcat/conf/web.xml文件。
在web.xml文件中,有一段如下:
? <welcome-file-list>
? <welcome-file>index.html</welcome-file>
? <welcome-file>index.htm</welcome-file>
? <welcome-file>index.jsp</welcome-file>
? </welcome-file-list>
在<welcome-file-list>與<welcome-file>index.html</welcome-file>之間添加上:
<welcome-file>a.jsp</welcome-file>
更改端口
<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" />??
將port "8080"改成你的端口
保存上述兩個文件后重啟tomcat,在瀏覽器地址欄內輸入"http://localhost:8080/",顯示a.jsp頁面的內容。??
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
