这是我的SpringMVC配置文件的一些信息:
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
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.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
<!-- 使spring扫描包下的所有类,让标注spring注解的类生效 -->
<context:component-scan base-package="cn.beike"/>
<!-- 对转向页面的路径解析。prefix:前缀, suffix:后缀 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>
<mvc:resources mapping="/images/**" location="/images/"/>
<mvc:resources mapping="/js/**" location="/js/"/>
<mvc:resources mapping="/css/**" location="/css/" />
<mvc:default-servlet-handler />
这是控制台输出的一些信息:
- (1440675 ms) - [DEBUG] 2017-05-06 10:32:29,019 org.springframework.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring' processing GET request for [/Real_estate/login.action]
- (1440677 ms) - [DEBUG] 2017-05-06 10:32:29,021 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Matching patterns for request [/login.action] are [/**]
- (1440678 ms) - [DEBUG] 2017-05-06 10:32:29,022 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - URI Template variables for request [/login.action] are {}
- (1440679 ms) - [DEBUG] 2017-05-06 10:32:29,023 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapping [/login.action] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler@69d64cf4] and 1 interceptor
- (1440680 ms) - [DEBUG] 2017-05-06 10:32:29,024 org.springframework.web.servlet.DispatcherServlet - Last-Modified value for [/Real_estate/login.action] is: -1
- (1440681 ms) - [DEBUG] 2017-05-06 10:32:29,025 org.springframework.web.servlet.DispatcherServlet - Null ModelAndView returned to DispatcherServlet with name 'spring': assuming HandlerAdapter completed request handling
- (1440682 ms) - [DEBUG] 2017-05-06 10:32:29,026 org.springframework.web.servlet.DispatcherServlet - Successfully completed request
这是web.xml的配置信息:
<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<!-- 指定Spring Bean的配置文件所在目录。默认配置在WEB-INF目录下 -->
contextConfigLocation
classpath:applicationContext-*.xml
<!-- spring字符编码过滤器start-->
<filter>
<!--① Spring 编码过滤器 -->
<filter-name>encodingFilter</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<!--② 编码方式 -->
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<!--③ 强制进行编码转换 -->
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<!-- ② 过滤器的匹配 URL -->
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- spring字符编码过滤器end-->
<!-- Spring MVC配置 -->
<!-- ====================================== -->
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Spring配置 -->
<!-- ====================================== -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- log4j配置start -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<!-- Spring 加载 Log4j 的监听 -->
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
<!-- log4j配置end -->
<!--
default
.jpg
default
.gif
default
.png
default
.js
default
*.css
-->
index.jsp