Maven 默认 SpringMVC-servlet.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"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
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.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- 扫描器,指定DispatcherServlet去扫描当前包名下的所有类, base-package属性不能精确到类级别,只能到包级别 -->
<context:component-scan
base-package="org.sprigmvc.pag" />
<context:component-scan
base-package="org.sprigmvc.dao" />
<!-- exception -->
<context:component-scan
base-package="org.sprigmvc.exception" />
<!-- 视图解析器 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean> <!-- 文件上传配置 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!--defaultEncoding:请求的编码格式必须和用户JSP的编码一致,以便正确读取表单中的内容。
uploadTempDir:文件上传过程中的临时目录,上传完成后,临时文件会自动删除
maxUploadSize:设置文件上传大小上限(单位为字节)-1为无限制 -->
<property name="defaultEncoding" value="UTF-8" />
<property name="maxUploadSize" value="102400000" />
<!-- uploadTempDir可以不做设置,有默认的路径,上传完毕会临时文件会自动被清理掉 -->
<property name="uploadTempDir" value="/upload/"></property>
</bean>
<!-- 处理器映射器 -->
<!-- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"
/> -->
<!-- 处理器适配器 -->
<!-- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"
/> -->
<!-- 配置注解驱动,配置之后就不用配置处理器映射器和处理器适配器了 -->
<mvc:annotation-driven />
<!-- 静态资源不拦截 -->
<mvc:resources location="/staticRescoures/"
mapping="/staticRescoures/**" />
<!-- 配置拦截器,可以配置多个拦截器,按顺序执行 -->
<!-- <mvc:interceptors>
第一个拦截器
<mvc:interceptor>
<mvc:mapping path="/**" /> 所有请求都拦截
<mvc:exclude-mapping path="/staticRescoures/**"/> 静态资源不拦截
<bean class="org.sprigmvc.Interceptor.MyInterceptor1" />
</mvc:interceptor>
第二个拦截器
<mvc:interceptor>
<mvc:mapping path="/**" /> 所有请求都拦截
<mvc:exclude-mapping path="/staticRescoures/**"/> 静态资源不拦截
<bean class="org.sprigmvc.Interceptor.MyInterceptor2" />
</mvc:interceptor>
</mvc:interceptors> -->
</beans>
Maven 默认 SpringMVC-servlet.xml 基本配置的更多相关文章
- springmvc 项目完整示例07 设置配置整合springmvc springmvc所需jar包springmvc web.xml文件配置
前面主要是后台代码,spring以及mybatis的整合 下面主要是springmvc用来处理请求转发,展现层的处理 之前所有做到的,完成了后台,业务层和持久层的开发完成了 接下来就是展现层了 有很多 ...
- maven spark Scala idea搭建maven项目的 pom.xml文件配置
1.pom.xml文件配置,直接上代码. <?xml version="1.0" encoding="UTF-8"?> <project xm ...
- Idea使用Maven搭建SpringMVC的HelloSpringMvc并配置插件Maven和Jetty
这篇博文只是纯粹的搭建一个SpringMVC的项目, 并不会涉及里面配置文件该写些什么. 只是纯粹的搭建一个初始的Hello SpringMVC的项目. 废话不多说,上图. 1. 打开IDEA 并且 ...
- spring-mvc基于xml的配置
配置web.xml <!--配置spring-MVC拦截--> <servlet> <servlet-name>DispatcherServlet</serv ...
- 利用maven开发springMVC项目(二)——框架配置
申明:主要内容来源于大神博客(使用IntelliJ IDEA开发SpringMVC网站(二)框架配置),我只是用eclipse自己练习使用,记录下来也只是为了学习使用,没有任何的商业用途,侵权必删. ...
- 基于 SpringMVC——web.xml基本配置
<!--声明应用范围内的初始化参数--> <context-param> <param-name>contextConfigLocation</param-n ...
- Maven+spring+springMVC+mybatis+Junit+Log4j配置个人总结
首先粘贴上项目引用地址:http://doc.okbase.net/fengshizty/archive/126397.html 这里对创建步骤不做过多解释,只是针对案例创建demo的一些 ...
- 利用maven开发springMVC项目(三)——数据库配置
前两节介绍了开发环境的搭建以及框架的配置 现在主要介绍在eclipse中如何将SpringMVC.hibernate.mysql数据库结合起来. 数据库配置 下面,就要通过一个简单的例子,来介绍Spr ...
- SpringMVC=>web.xml基本配置
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmln ...
- Java Servlet XML文件配置
随机推荐
- 2019.5.13-5.17知识点:文件管理、目录操作、索引节点、软硬链接,vim文本编辑 知识点
文件管理 ● cp 复制文件 cp /路径(原文件) /路径(复制文件)/文件重命名(可选) -i:覆盖前询问 -r:递归复制目录及内部内容 -a:归档,相当于-dr --preser ...
- IIS 调试配置
- PHP中把对象转数组的几个方法
PHP中把对象转数组的几个方法: 1. //PHP stdClass Object转array function object_array($array) { if(is_object($array) ...
- c++字符和字符串转整数类型及大小端
在网络传输中,很多数据都是按字节传递而不是字符串.最近就遇到了这个问题,在刚开始学c语言时都没有问题,可能太久不用了,记录一下 在报中文,用2个字节hex码来表示报文正文长度,什么是hex码呢 就是1 ...
- js抽奖,跑马灯
分享自己写的跑马灯抽奖. HTML代码 <!--首先将一个div的背景设为一个圆形--> <div style=" width:240px; height:232px; b ...
- ubuntu下mysql的用户添加、授权、取消授权
一.添加用户 新增用户会有两种方式的,一种是使用create命令,另一种是直接回使用grant 命令 create user 名字@登陆地址 identified by "密码"; ...
- Web应用界面好帮手!DevExtreme React和Vue组件全新功能上线
行业领先的.NET界面控件DevExpress 正式发布了v19.1版本,本文将主要介绍DevExtremev19.1中React组件响应式应用程序布局模板及CLI工具.本地React图表,和Vue组 ...
- 【vs2015发布程序】
1.选中网站右键,选择发布Web应用 2.发布目标选择自定义 3.配置文件名称 4.发布方式选择File System,选择发布的程序存放路径 5.
- 【C#-多线程】实现每隔一段时间执行代码(多线程) 3种定时器
总结以下三种方法,实现c#每隔一段时间执行代码: 方法一:调用线程执行方法,在方法中实现死循环,每个循环Sleep设定时间: 方法二:使用System.Timers.Timer类: 方法三:使用Sys ...
- Springboot的resources下资源访问的问题
对于路径问题,是让我一直感到痛苦的事情,首先是因为我的眼高手低,感觉路径这么简单根本没必要去看,但是昨天项目组长的冷嘲热讽让我无地自容:“你竟然连linux和window的路径的区别都不知道,呵呵”. ...