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文件配置
随机推荐
- linux使用nginx配置web服务器
环境: CenterOS 7 1.安装nginx之前先安装nginx所需的依赖包 yum -y install zlib zlib-devel openssl openssl-devel pcre p ...
- ThreadLocal <T>类的说明 转载 原作者 lujh99
首先,ThreadLocal 不是用来解决共享对象的多线程访问问题的,一般情况下,通过ThreadLocal.set() 到线程中的对象是该线程自己使用的对象,其他线程是不需要访问的,也访问不到的.各 ...
- Linux用户组管理及用户权限4
权限管理: ls -l rwxrwxrwx: 左三位:定义user(owner)的权限 中三位:定义group的权限 ...
- oracle学习1 基于oracle数据库的PLSQL编程以及存储过程的创建和使用视频
https://www.bilibili.com/video/av46777605 plsql中选择testWindow中可以进行测试 1.编写函数在plsql的testwindow中 begin d ...
- C#学习之Timothy Liu
原文出自 本文摘录了一些值得学习的地方. 1.对一个程序来说,静态指编辑期.编译期,动态指运行期. 静态时装在硬盘里,动态时装在内存里. 2.反射示例 通过反射获得类的属性和方法. static vo ...
- 第二章 Vue快速入门--13 讲解v-model实现表单元素的数据双向绑定
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- 2019.9.30 ErrorWidget 的使用
开发过程中总会碰见页面出现错误的情况,这时候整个页面一片红, 如下 测试阶段出现这样的问题就算了,万一正式环境也出现这个就要不和谐了.所以就有了ErrorWidget.这个是要在最底层设置一下就可以屏 ...
- li每三个换行
背景:鉴于有时候调取数据用table不方便,所以用的li,但是li又没有table的样式,就需要自己写了 思路:先将所有的li浮动,然后清除第3n+1的浮动(如果是四个则是4n+1) 例子: &l ...
- 使用gpg来加密数据
一.数据的加密方式 数据加密有三种方式: 1.对称加密(算法有:DES.AES.3DES.)加密和解密使用同一个密钥 2.非对称加密(RSA.DSA.ELGamal等等)一共四把钥匙,用公钥加密数据, ...
- nginx跨站访问,防盗链
跨站访问 从网站A利用AJAX跨站访问网站B 浏览器会根据服务端返回的头部信息(Access-Control-Allow-Origin)判断是否允许跨域访问.如果服务端都允许跨站访问,浏览器段也就没必 ...