1.tomcat原來的默認根目錄是http://localhost:8080,如果想修改訪問的根目錄,可以這樣:
找到tomcat的server.xml(在conf目錄下),找到:
<
Host
name
="localhost"
appBase
="webapps"
unpackWARs
="true"
autoDeploy
="true"
xmlValidation
="false"
xmlNamespaceAware
="false"
></
Host
>
?
在</Host>前插入:
<
Context
path
=""
docBase
="D:/eclipse3.3/jb51.net/tomcat/"
debug
="0"
/>
其中D:/eclipse3.3/jb51.net/tomcat/就是我想設置的網站根目錄,然后重啟tomcat。
再次訪問http://localhost:8080時,就是直接訪問D:/eclipse3.3/jb51.net/tomcat/目錄下的文件了。
2.tomcat的web.xml(在conf目錄下),在該文件中找到
<
welcome-file-list
>
<
welcome-file
>
index.html
</
welcome-file
>
<
welcome-file
>
index.htm
</
welcome-file
>
<
welcome-file
>
index.jsp
</
welcome-file
>
</
welcome-file-list
>
?
這是tomcat默認的3個文件,當你輸入指定路徑后,tomcat會自動查找這3個頁面。如果你想讓tomcat自動找到自己的頁面,比如main.jsp。可以修改上面信息為:
<
welcome-file-list
>
<
welcome-file
>
main.jsp
</
welcome-file
>
<
welcome-file
>
index.html
</
welcome-file
>
<
welcome-file
>
index.htm
</
welcome-file
>
<
welcome-file
>
index.jsp
</
welcome-file
>
</
welcome-file-list
>
?
這樣就可以了。
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元

