0
我發郵件數小時後發佈。 我試圖將正常的.jsp
文件引用到另一個文件中,但我收到HTTP狀態404錯誤。HTTP狀態404 JSP文件(沒有servlet沒有目錄失敗)
這是的index.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<a href="user.jsp">LINK</a>
</body>
</html>
的user.jsp位於/ web文件夾(帶的index.jsp),而不是一個servlet。
我也創造了的web.xml文件(谷歌搜索,但我知道,沒有必要到正常.jsp文件登記)爲如下:
<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">
<display-name>test</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>user.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
的錯誤是一樣的如果我刪除條目welcome-file-list
。
我使用的是TomEE 1.7.4。
預先感謝您。
你能詳細介紹一下你項目的文件樹嗎?你的工作空間怎麼樣?在交付時如何(戰爭文件或爆炸戰爭)。例如,我主要關心您的Web文件夾所在的位置,例如WEB-INF文件夾。 –
如果user.jsp和index.jsp都在相同的路徑中,它應該可以工作。 – notionquest