我知道有人已經問過這個問題,但我沒有得到我想要的答案。所以我試圖運行使用Tomcat JSP頁面,但我不斷收到以下錯誤信息:Eclipse-HTTP狀態404
HTTP Status 404 - /LoginWeather/
type Status report
message /LoginWeather/
description The requested resource is not available.
的Apache Tomcat/7.0.39
服務器配置正確,本地主機: 8080功能正常。這是我的web.xml和我的.jsp文件內容: web.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>LoginWeather</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
的login.jsp:``
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!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>Welcome</title>
</head>
<body>
<s:form>
<s:textfield label="Username" key="userName"/>
<s:password label="Password" key="password"/>
<s:submit/>
</s:form>
</body>
</html>
試一下'http:// localhost:8080/LoginWeather/login.jsp' – 2013-04-25 17:04:00
當你只運行JSP時,那麼這個url就是你給的那個,我已經試過了。同樣的錯誤出現。 – 2013-04-25 17:44:09
我不知道你把JSP放在哪裏,404意味着你的JSP不存在。 – 2013-04-25 20:33:49