spring mvc配置文件dispatcher-servlet.xml详解
Spring的配置文档
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.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">
<!-自动扫描controller--->
<context:component-scan base-package="com.zenointel.p2p.web.controller"/>
<!--验证器-->
<mvc:annotation-driven validator="validtor">
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven> <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="cookieMaxAge" value="31536000" />
</bean>
<!-定义映射-->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/services/**"/>
<mvc:exclude-mapping path="/css/**"/>
<mvc:exclude-mapping path="/js/**"/>
<mvc:exclude-mapping path="/img/**"/>
<mvc:exclude-mapping path="/fonts/**"/>
<mvc:exclude-mapping path="/webfile/**"/>
<mvc:exclude-mapping path="/theme/**"/>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"/>
</mvc:interceptor>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/services/**"/>
<mvc:exclude-mapping path="/css/**"/>
<mvc:exclude-mapping path="/js/**"/>
<mvc:exclude-mapping path="/img/**"/>
<mvc:exclude-mapping path="/fonts/**"/>
<mvc:exclude-mapping path="/webfile/**"/>
<mvc:exclude-mapping path="/theme/**"/>
<bean class="com.zenointel.p2p.web.interceptor.P2PInterceptor"/>
</mvc:interceptor>
</mvc:interceptors> <mvc:resources mapping="/favicon.ico" location="/"/>
<mvc:resources mapping="/css/**" location="/css/"/>
<mvc:resources mapping="/js/**" location="/js/"/>
<mvc:resources mapping="/img/**" location="/img/"/>
<mvc:resources mapping="/fonts/**" location="/fonts/"/>
<mvc:resources mapping="/theme/**" location="/theme/"/>
<!-定义视图(视图解析器)>
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/> <!-jsp都放在WEB-INF/jsp目录下->
<property name="suffix" value=".jsp"/> <!-jsp页面的后缀都是.jsp-->
</bean> <bean id="captchaProducer"
class="com.google.code.kaptcha.impl.DefaultKaptcha">
<property name="config">
<bean class="com.google.code.kaptcha.util.Config">
<constructor-arg type="java.util.Properties">
<props>
<prop key="kaptcha.image.width">100</prop>
<prop key="kaptcha.image.height">30</prop>
<prop key="kaptcha.textproducer.char.string">0123456789</prop>
<prop key="kaptcha.textproducer.char.length">4</prop>
<prop key="kaptcha.textproducer.font.size">30</prop>
<prop key="kaptcha.textproducer.font.color">black</prop> </props>
</constructor-arg>
</bean>
</property>
</bean>
<!--================ 中文国际化================-->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messageSource"/>
<property name="cacheSeconds" value="300"/>
</bean> <bean id="validtor" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="validationMessageSource" ref="messageSource"/>
</bean>
<!--================ 文件上传================-->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="20971520"/>
<property name="resolveLazily" value="true"/>
</bean> <context:property-placeholder order="1" location="classpath:application.xml" /> <bean id="webConfig" class="com.zenointel.p2p.web.util.WebConfig" /> </beans>
spring mvc配置文件dispatcher-servlet.xml详解的更多相关文章
- spring boot 配置文件properties和YAML详解
spring boot 配置文件properties和YAML详解 properties中配置信息并获取值. 1:在application.properties配置文件中添加: 根据提示创建直接创建. ...
- spring, spring mvc, mybatis整合文件配置详解
转自:http://www.cnblogs.com/wxisme/p/4924561.html 使用SSM框架做了几个小项目了,感觉还不错是时候总结一下了.先总结一下SSM整合的文件配置.其实具体的用 ...
- 1-2 hibernate主配置文件hibernate.cfg.xml详解
详 http://www.cnblogs.com/biehongli/p/6531575.html Hibernate的主配置文件hibernate.cfg.xml 1:Hibernate的主配置文件 ...
- Spring MVC的原理及配置详解
网址链接:https://www.cnblogs.com/baiduligang/p/4247164.html
- spring MVC请求处理类注解属性详解
- Tomcat配置(二):tomcat配置文件server.xml详解和部署简介
*/ .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; } .hl ...
- Tomcat(二):tomcat配置文件server.xml详解和部署简介
Tomcat系列文章:http://www.cnblogs.com/f-ck-need-u/p/7576137.html 1. 入门示例:虚拟主机提供web服务 该示例通过设置虚拟主机来提供web服务 ...
- logback的使用和logback.xml详解,在Spring项目中使用log打印日志
logback的使用和logback.xml详解 一.logback的介绍 Logback是由log4j创始人设计的另一个开源日志组件,官方网站: http://logback.qos.ch.它当前分 ...
- Logback简介及配置文件logback.xml详解
logback简介及配置文件说明 @author:wangyq @date:2021年3月31日 logback简介 Logback是由log4j创始人设计的另一个开源日志组件,官方网站: htt ...
- Maven配置文件setting.xml详解
注:本文来源于:大话JAVA的那些事 <Maven配置文件setting.xml详解> <?xml version="1.0" encoding="UT ...
随机推荐
- Bluez alpha版震撼发布!
经过Z.XML团队所有成员的不懈努力,我们的Bluez alpha版成功完成了!现在我们宣布:Bluez alpha版正式发布! 首先我们来向大家介绍下我们这个游戏: 这是一款即时RPG塔防类游戏.在 ...
- WOSA协议(转)
WOSA(全称是Windows开放式系统体系结构 Windows Open System Architecture),是微软公司提出的一种在Windows操作系统下的软件架构 WOSA/XFS是基于W ...
- kinect学习笔记(三)——深度数据的提取
一.创建Console工程 二.添加kinect引用 里面用引用,打开后 选择然后OK. 三.编写代码(有附加注释) using System; using System.Collections.Ge ...
- loadrunner关联边界乱码
问题现象: 如上图中的我想关联 <ins class="curmarker" id="cur2494"></ins><ins cl ...
- 最短路(Bellman_Ford) POJ 1860 Currency Exchange
题目传送门 /* 最短路(Bellman_Ford):求负环的思路,但是反过来用,即找正环 详细解释:http://blog.csdn.net/lyy289065406/article/details ...
- Mac terminal 解压压缩
tar 解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)———————————————.gz解压1:gunz ...
- Rain on your Parade
Rain on your Parade Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 655350/165535 K (Java/Ot ...
- Codeforces Round #195 (Div. 2) D题Vasily the Bear and Beautiful Strings
这场CF,脑子乱死啊...C题,搞了很长时间,结束了,才想到怎么做.B题,没看,D题,今天看了一下,很不错的组合题. 如果n和m都挺多的时候 以下情况都是变为1,根据偶数个0,最后将会为1,奇数个0, ...
- pygame系列_百度随心听_完美的UI设计
这个程序的灵感来自于百度随心听 下面是我的程序截图: 说明: 动作按钮全部是画出来的,没有用到任何图片 用到图片的只有:背景,歌手图片,作者图片 代码正在调试中.... 如果你鼠标移动到黄色小圆里面, ...
- CentOS目录结构超详细版
最近初学Linux 对linux的目录产生了很多疑问,看到这篇文章,让我顿时对目录有了一个清晰的认识!推荐给大家! ------------------------------------------ ...