Tomcat和Weblogic部署純html文件


1、首先純html文件,得有一個入口 index.html

2、Tomcat是不需要指定web.xml的,因為即使你的文件里沒有web.xml,也會讀取conf 目錄下的web.xml,在這個文件里邊指定了index.html的入口

Tomcat的話只要將原文件部署到 webapps\ 目錄下,或者在\conf\Catalina\localhost 目錄下新建xml文件,指向html頁面

<?xml version='1.0' encoding='utf-8'?>
    <Context docBase="C:\Users\jiashubing\Desktop\dist" 
    reloadable="false" privileged="true" antiResourceLocking="false" antiJARLocking="false">       
</Context>

 

3、如果是Weblogic的話, 可以直接發布war包,但是如果想要發布純html文件,必須要新建WEB-INF\web.xml 文件,否則無安裝部署

web.xml 文件的寫法也很簡單,注意格式,不要有中文字符

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">

  <welcome-file-list>
    <welcome-file>index</welcome-file>
  </welcome-file-list>

  <!--或者寫成這種形式-->
  <!--<welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>-->

</web-app>

 

原創文章,歡迎轉載,轉載請注明出處!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM