没有找到带有URI的HTTP请求的映射

时间:2011-07-11 05:02:44

标签: java spring

我收到此错误

在名为'val'的DispatcherServlet中找不到具有URI [/ val / valsys / auth / login]的HTTP请求的映射

<?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>val</display-name>

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
     <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
</filter-mapping>


<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/spring-security.xml
    /WEB-INF/applicationContext.xml 
    /WEB-INF/dwr-context.xml    
    </param-value>
</context-param>

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>

<context-param>
    <param-name>log4jRefreshInterval</param-name>
    <param-value>1000</param-value>
</context-param>


<servlet>
  <servlet-name>val</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
  <servlet-name>val</servlet-name>
  <url-pattern>/*</url-pattern>
</servlet-mapping>

 <servlet-mapping>
  <servlet-name>val</servlet-name>
  <url-pattern>/valsys/dwr/*</url-pattern>
</servlet-mapping>

<listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<listener>
 <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list> 
</web-app>

这就是我的dispatcher.xml的样子..

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" 
xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<!-- Declare a view resolver -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" 
        p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

</beans>

2 个答案:

答案 0 :(得分:1)

将您的请求映射到调度程序servlet 但是您的调度程序中没有定义任何映射,因此无法处理它

看看这个simple example

答案 1 :(得分:0)

在'WEB-INF / web.xml'中,我们声明Spring DispatcherServlet并将'* .html'URL映射到它: