2017-02-08 25 views
1

我寫了一個基本的Hello World我們的動態項目,並安裝了apache服務器。如何看到web.xml是在我的Web項目中讀取的

我的目錄結構, enter image description here

的web.xml內容,

<display-name>hello</display-name> 
    <welcome-file-list> 
    <welcome-file>hello.html</welcome-file> 

    </welcome-file-list> 

hello.html的是,

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Insert title here</title> 
</head> 
<body> 
Hello World!! 
</body> 
</html> 

開始我的Apache後,我試圖訪問URL,
http://localhost:8080/hello.html
Getti ng錯誤爲:HTTP狀態404 - /hello.html
任何建議?

+0

有一個在你的項目目錄中沒有的hello.xml。正確的URL應該是http:// localhost:8080/hello.html – KayV

回答

0

我會說你需要進入更深的目錄。

http://localhost:8080/WebContent/hello.html

上面應該工作,我覺得:)

+0

仍然是404錯誤。順便說一句,爲什麼我們需要包含WebContent? – MSD

+0

您需要基本打開每個文件夾直到hello.xml目錄。 – BotMaster3000

+0

由於程序不能查看這些文件夾中的內容,因此它只能看到當前文件夾中的內容。 – BotMaster3000

0

通常這個錯誤是使用8080端口的其他應用程序,檢查是否還有相同的端口上的任何程序。

相關問題