SpringMVC的web.xml配置介绍(转)版权声明
原创出处http://blog.csdn.net/u010796790
1、 spring 解决字符串编码问题的框架:过滤器 CharacterEncodingFilter (filter-name)
2、在web.xml配置侦听器 ContextLoaderListener (listener-class)
ContextLoaderListener角色是开始Web容器自动组装时ApplicationContext的配置信息。因为它实现了ServletContextListener此接口,在web.xml配置此侦听器,以便在容器启动时,它实现的方法将在默认情况下执行。
3、部署applicationContext的xml文件: contextConfigLocation (context-param下的param-name)
4、DispatcherServlet前控制器是否配置在web.xml在文件中。拦截匹配请求,Servlet拦截匹配规则应该自己定义,拦截的请求应该按照一定的规则分发给目标。Controller(我们写的Action)来处理。
DispatcherServlet (servlet-name、servlet-class、init-param、param-name(contextConfigLocation)、param-value)
在DispatcherServlet在初始化过程中,框架将处于。web应用的 WEB-INF查找名为的文件夹[servlet-name]-servlet.xml 生成文件中定义的配置文件。bean

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app\_3\_0.xsd">
characterEncodingFilter
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
forceEncoding
true
characterEncodingFilter
/*
org.springframework.web.context.ContextLoaderListener
contextConfigLocation
classpath:spring/applicationContext.xml
default
*.css
default
*.swf
default
*.gif
default
*.jpg
default
*.png
default
*.js
default
*.html
default
*.xml
default
*.json
default
*.map
DispatcherServlet
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:spring/dispatcher-servlet.xml
1
DispatcherServlet
/
login.html
404
/nopage.html
java.lang.NullPointerException
/error.html
360
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
itfan123



