2016-12-06 224 views
0

如何在web.xml中配置welcome-file標記以不同的路徑,如HTML/welcome.html。如何將web.xml中的welcome-file-list標記配置爲不同的路徑,如<welcome-file> HTML/welcome.html</ welcome-file>

<welcome-file-list> 
    <welcome-file>HTML/welcome.html</welcome-file> 
</welcome-file-list> 

請幫幫我。

文件夾的結構是:

Web-inf 
>HTML 
web.xml 
index.html 

P.S HTML是一個文件夾。我想在HTML文件夾中使用一個頁面作爲我的歡迎頁面。

如何做到這一點?

回答

0

您必須將WEB-INF以外的HTML文件夾。 web.xml應該在WEB-INF中。

WEB-INF 
    |_ web.xml 
HTML 
    |_ index.html 
    |_ welcome.html 

這樣做,在你的web.xml文件將是這樣的:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> 
    <welcome-file-list> 
     <welcome-file>html/welcome.html</welcome-file> 
    </welcome-file-list> 
</web-app> 

我希望我可以幫助你。

+0

謝謝安德魯.. :) – Raghav

相關問題