【发布时间】:2015-04-12 10:16:01
【问题描述】:
我是使用 apache 和 spring 框架的新手,我一直在使用本教程进行学习:http://docs.spring.io/docs/Spring-MVC-step-by-step/part1.html 我创建了一个 .jsp 文件,但是我的浏览器告诉我“请求的资源不可用。”
.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>
知道如何解决这个问题吗?
【问题讨论】:
-
您正在遵循 7 年前编写的指南。它甚至使用 Ant。你知道新的 Spring 文档吗:spring.io/docs
标签: spring apache jsp tomcat ant