<mvc:default-servlet-handler />

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:mvc= "http://www.springframework.org/schema/mvc" 
    xmlns:p= "http://www.springframework.org/schema/p" 
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
	http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  	http://www.springframework.org/schema/context   
   http://www.springframework.org/schema/context/spring-context-2.5.xsd
   http://www.springframework.org/schema/mvc
   http://www.springframework.org/schema/mvc/spring-mvc.xsd
">
<mvc:default-servlet-handler />

遇到可以找到controller却找不到页面的情况,加个这个就可以了

原理是,serlvet在找页面的时候,走的是dispatchservlet的路径,找不到的时候会报404

加个这个默认的servlet,servlet在找不到的时候会去找静态的内容,就找到这个页面了

猜你喜欢

转载自sjy-showtime.iteye.com/blog/1965356