使用Spring时web.xml中的配置
使用Spring时web.xml中的配置:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!--添加过滤器-->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--配置spring-->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--自定义首页-->
<!-- <welcome-file-list>
<welcome-file>/first/page</welcome-file>
</welcome-file-list>-->
<!--配置404错误页面-->
<error-page>
<error-code>404</error-code>
<location>/error_pages/404.jsp</location>
</error-page>
<!--配置500错误提示-->
<error-page>
<error-code>500</error-code>
<location>/error_pages/500.jsp</location>
</error-page> <!--读取静态文件-->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
<url-pattern>*.css</url-pattern>
<url-pattern>*.woff</url-pattern>
<url-pattern>*.woff2</url-pattern>
<url-pattern>*.ttf</url-pattern>
<url-pattern>*.png</url-pattern>
<url-pattern>*.jpg</url-pattern>
<url-pattern>*.ogg</url-pattern>
<url-pattern>*.mp4</url-pattern>
</servlet-mapping> </web-app>
使用Spring时web.xml中的配置的更多相关文章
- J2EE进阶(五)Spring在web.xml中的配置
J2EE进阶(五)Spring在web.xml中的配置 前言 在实际项目中spring的配置文件applicationcontext.xml是通过spring提供的加载机制自动加载到容器中.在web ...
- spring在web.xml中的配置
在实际项目中spring的配置文件applicationcontext.xml是通过spring提供的加载机制,自动加载的容器中去,在web项目中,配置文件加载到web容器中进行解析,目前,sprin ...
- Spring中,applicationContext.xml 配置文件在web.xml中的配置详解
一.首先写一下代码结构. 二.再看web.xml中的配置情况. <?xml version="1.0" encoding="UTF-8"?> < ...
- spring 和springmvc 在 web.xml中的配置
(1)问题:如何在Web项目中配置Spring的IoC容器? 答:如果需要在Web项目中使用Spring的IoC容器,可以在Web项目配置文件web.xml中做出如下配置: <!-- Sprin ...
- SpringMVC(十六):如何使用编程方式替代/WEB-INF/web.xml中的配置信息
在构建springmvc+mybatis项目时,更常用的方式是采用web.xml来配置,而且一般情况下会在web.xml中使用ContextLoaderListener加载applicationCon ...
- Struts在Web.xml中的配置及Struts1和Struts2的区别
(1)配置Struts的ActionServlet <servlet>元素来声明ActionServlet <servlet-name>元素:用来定义Servle ...
- Spring web.xml中的配置
转载博客:http://blog.163.com/zhangke_616/blog/static/191980492007994948206/ 在实际项目中spring的配置文件application ...
- Logback初始化失败问题排查(Web.xml中context-param配置详解)
监控部分反馈异常,生产系统日志文件竟然木有了(最后一次版本发布后,再也无日志文件生成). 问题排查步骤: 1. 检查logback配置文件 日志生成目录一切正常 应该服务器上磁盘空间未满.操作权限没有 ...
- web.xml中JSP配置及 EL表达式
web.xml 中JSP配置.servlet配置 及 EL表达式 [摘要] servlet 基本配置 <servlet> <servlet-name>LoginServlet& ...
随机推荐
- FreeMarker example all in one
Pick up from http://demojava.iteye.com/blog/800204
- Axios插件和loading的实现
axios插件就是一个ajax插件 axios具有ajax的所有方法如 get post delete put等等的方法 使用时只需要引入即可 如import Axios form 'axios' 不 ...
- pandas 级联 concat append
连接的一个有用的快捷方式是在Series和DataFrame实例的append方法.这些方法实际上早于concat()方法. 它们沿axis=0连接 #encoding:utf8 import pan ...
- codeforces469B
Chat Online CodeForces - 469B 问题描述 你和你的朋友经常在网上聊天.你的朋友作息规律每天只会在p个时间段[ai,bi]在线.你作息混乱,假设你在t时刻起床,那么你会在q个 ...
- Codeforces960G Bandit Blues 【斯特林数】【FFT】
题目大意: 求满足比之前的任何数小的有A个,比之后的任何数小的有B个的长度为n的排列个数. 题目分析: 首先写出递推式,设s(n,k)表示长度为n的排列,比之前的数小的数有k个. 我们假设新加入的数为 ...
- ROADS POJ - 1724(分层最短路)
就是在最短路的基础上 多加了一个时间的限制 , 多一个限制多一维就好了 记住 分层最短路要用dijistra !!! #include <iostream> #include < ...
- BZOJ 4499: 线性函数
4499: 线性函数 Time Limit: 20 Sec Memory Limit: 256 MBSubmit: 177 Solved: 127[Submit][Status][Discuss] ...
- 移除SharePoint2013里的NoteBook笔记本链接
cls $featureID = (Get-SPFeature | ?{ ($_.DisplayName -eq "SiteNotebook") -and ( $_.Scope - ...
- pascal与其它语言代码书写的不同和pascal的快捷键
1.把很多简单语句括起来 begin end; 2.开始,结束 begin end. 3.判断if if (布尔表达式) then begin 语句 end //没有‘:’ else if () b ...
- poj 3683(2-SAT+SCC)
传送门:Problem 3683 https://www.cnblogs.com/violet-acmer/p/9769406.html 参考资料: [1]:挑战程序设计竞赛 题意: 有n场婚礼,每场 ...