<?xml version="1.0" encoding="UTF-8"?>
encodingFilter
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
encodingFilter
/*
springmvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:NETCTOSS.xml
1
springmvc
*.do
这是 web.xml的设置
<?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:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
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/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-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/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
<!-- 配置组件扫描 -->
<!-- 配置MVC注解扫描 -->
<!-- 配置视图解析器 -->
<!-- 配置拦截器 -->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/toLogin.do"/>
<bean class="cn.tedu.nectoss.interceptors.SessionInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
<!-- 读取db.properties文件 -->
<util:properties id="db" location="classpath:db.properties" />
<!-- 配置连接池 -->
<bean id="ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="#{db.driver}"/>
<property name="url" value="#{db.url}"/>
<property name="username" value="#{db.user}"/>
<property name="password" value="#{db.pwd}"/>
</bean>
<!-- 配置SqlSessionFactoryBean -->
<bean id="ssfb" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 指定连接池 -->
<property name="dataSource" ref="ds"/>
<!-- 指定映射文件 -->
<property name="mapperLocations" value="cn/tedu/netctoss/entity/mapper/*.xml"/>
</bean>
<!-- 配置MapperScannerConfigurer *-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 指定映射器所在的包名 -->
<property name="basePackage" value="cn.tedu.netctoss.dao"/>
<!-- 指定注解类 ****-->
<!-- <property name="annotationClass" value=""/> -->
</bean>
这是容器的设置
另外:我用的是jdk1.6(系统有双jdk 1.6和1.8) 也试过高版本的spring-webmvc 还是报错 测试文件全部通过,包括dao层,Servlet层 但一在tomcat上跑就不行