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文件配置
随机推荐
- springboot中使用filter用配置类方式
在03-springboot-web的Filter包下,创建HeFilter类 代码示例: package com.bjpowernode.springboot.filter; import java ...
- C# NET 微信临时素材上传
最近在做这个,一开始也是不明白为什么给个URL带着两个参数就直接上传了,网上看了很多都是PHP,但是PHP没看过是不会 的 所以就一直在找网上什么Demo之类的讲解,最后还是不错找到了一个比较好理解的 ...
- java 多线程,线程安全等定义
线程安全, synchronized的使用,保证方法或代码块操作的原子性.可见性和有序性 参考这篇文章: 7张图带你轻松理解Java 线程安全 public class ThreadDemo { pr ...
- adb常见命令
adb(Android Debug Bridge)主要存放在sdk安装目录下的platform-tools文件夹中,他是一个非常强大的命令行工具.学习adb命令是我在从事兼职测试工作的时候需要掌握 ...
- Ubuntu 安装openmpi
Ubuntu14.04TLS安装openmpi参考:https://likymice.wordpress.com/2015/03/13/install-open-mpi-in-ubuntu-14-04 ...
- PHP Swoole websocket协议实现
- PHP swoole TCP服务端和客户端
服务端 <?php $server = ,SWOOLE_PROCESS,SWOOLE_SOCK_TCP); $server->set(array( , )); $server->on ...
- 第十一章 前端开发-JavaScript
第十一章 前端开发-JavaScript 11.3.1 js引入方式 行内样式 <p id="" class="" style="" ...
- 使用Navicat客户端运行SQL语句出现中文乱码
出现乱码无非就是编码方式不统一造成的,通过查阅资料解决了问题. (简 体中文系统环境支持国标 GB2312.GB18030 和 Unicode (UTF-8) 编码.它们在系统中设置的locale(亦 ...
- 解压 压缩 C#
public class SharpZip { public SharpZip() { } /// <summary> /// 压缩 /// </summary> /// &l ...