【发布时间】:2011-12-08 18:37:59
【问题描述】:
我已经开始使用spring并且遇到这个错误
在名称为“SpringSocialSample”的 DispatcherServlet 中找不到具有 URI [/SpringSocialSample/login.htm] 的 HTTP 请求的映射
我发现 login.htm 不能被调度程序 servlet 定位
我的 SpringSocialSample-servlet.xml
<context:component-scan
base-package="com.social.spring.controllers" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/views/" p:suffix=".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_2_5.xsd"
id="WebApp_ID"
version="2.5">
<display-name>SpringSocialSample</display-name>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>updatestatus.root</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>SpringSocialSample</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringSocialSample</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
我有 index.jsp 我重定向到 login.jsp 放置在 WEB-INF/views..
【问题讨论】:
标签: java spring spring-mvc