修改tomcat默認頁面爲自己項目首頁面

修改配置文件:   
    
   首先,修改$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="D:\hbjobwork\WebRoot5" reloadable="true" crossContext="true" >

    
   path是說明虛擬目錄的名字,如果你要只輸入ip
就顯示主頁,則該鍵值留爲空;   
    
   docBase是虛擬目錄的路徑,它默認的是$tomcat/webapps/ROOT目錄,現在目錄已經指向到D:\hbjobwork\WebRoot5目錄,讓該目錄作爲我的默認目錄。   
    
   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>   
    
   保存上述兩個文件後重啓tomcat,在瀏覽器地址欄內輸入"http://localhost:8080/",顯示a.jsp頁面的內容。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章