http 状态 404 hello.jsp (apache tomcat 6)
http status 404 hello.jsp (apache tomcat 6)
我是使用 apache 和 spring 框架的新手,我一直在使用本教程进行学习:http://docs.spring.io/docs/Spring-MVC-step-by-step/part1.html
我制作了一个 .jsp 文件,但是我的浏览器告诉我 "The requested resource is not available."
.jsp 文件非常简单
<html>
<head><title>Hello :: Spring Application</title></head>
<body>
<h1>Hello - Spring Application</h1>
<p>Greetings.</p>
</body>
</html>
输入 http://localhost:8080/project/hello.htm 返回 404。
我的 web.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<servlet>
<servlet-name>project</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>project</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
</web-app>
知道如何解决这个问题吗?
404错误表示请求的资源不在服务器中。
您的问题可以是
1. 没有正确匹配 hello.htm 到任何控制器
bean id="/hello.htm" class="foo.controller" 或
2. 你必须将 hello.jsp 和 index.jsp 一起放在 webcontent 文件夹中。不在 WEB-INF 文件夹中。参考教程。
我是使用 apache 和 spring 框架的新手,我一直在使用本教程进行学习:http://docs.spring.io/docs/Spring-MVC-step-by-step/part1.html 我制作了一个 .jsp 文件,但是我的浏览器告诉我 "The requested resource is not available."
.jsp 文件非常简单
<html>
<head><title>Hello :: Spring Application</title></head>
<body>
<h1>Hello - Spring Application</h1>
<p>Greetings.</p>
</body>
</html>
输入 http://localhost:8080/project/hello.htm 返回 404。 我的 web.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<servlet>
<servlet-name>project</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>project</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
</web-app>
知道如何解决这个问题吗?
404错误表示请求的资源不在服务器中。 您的问题可以是
1. 没有正确匹配 hello.htm 到任何控制器
bean id="/hello.htm" class="foo.controller" 或
2. 你必须将 hello.jsp 和 index.jsp 一起放在 webcontent 文件夹中。不在 WEB-INF 文件夹中。参考教程。