springmvc在web.xml中的常用配置
来源:互联网 发布:java 中编译后无src 编辑:程序博客网 时间:2024/04/29 05:16
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>Demo</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <context-param> <description>springmvc配置文件</description> <param-name>contextConfigLocation</param-name> <param-value>classpath:com/resource/spring_*.xml</param-value> </context-param> <servlet> <description>spring核心分发器</description> <servlet-name>springDispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:com/resource/spring_*.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springDispatcher</servlet-name> <url-pattern>*.mvc</url-pattern> </servlet-mapping> <listener> <description>spring上下文侦听器</description> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <filter> <description>spring编码过滤器</description> <filter-name>spring-characterEncoding-filter</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> </filter> <filter-mapping> <filter-name>spring-characterEncoding-filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
<servlet-mapping>静态资源处理<servlet-name>default</servlet-name><url-pattern>/*.html</url-pattern><url-pattern>/*.jpg</url-pattern><url-pattern>/*.js</url-pattern><url-pattern>/*.css</url-pattern></servlet-mapping></web-app>
有关springmvc的静态资源处理http://blog.csdn.net/shewmi/article/details/78015070
有关路径统配问题http://blog.csdn.net/shewmi/article/details/77998293
spring4.3.8
需要注意的事项:
1、配置文件资源路径建议使用下划线_的形式,如spring_mvc,不推荐使用spring-mvc,因为springmvc默认会查找dispatherServlet-servlet.xml文件,如果找不到,则会匹配*-servlet.xml的配置文件,所以使用-容易造成配置文件不存在的错误。
2、上下文侦听器需springmvc配置文件,因此需要先配置springmvc配置文件路径参数。
3、编码过滤器在使用spring表单的时候非常有用。
阅读全文
0 0
- springmvc在web.xml中的常用配置
- spring 和springmvc 在 web.xml中的配置
- springmvc中的web.xml的配置讲解
- springMvc在web.xml文件的配置
- springmvc在web.xml配置路径后缀
- SpringMVC配置web.xml文件详解(列举常用的配置)
- SpringMVC配置web.xml文件详解(列举常用的配置)
- SpringMVC配置web.xml文件详解(列举常用的配置)
- SpringMVC配置web.xml文件详解(列举常用的配置)
- SpringMVC web.xml配置
- SpringMVC web.xml配置
- 在web.xml中配置SpringMVC的启动配置项
- fileter 在web.xml中的配置
- acegi 在Web.xml中的配置
- Filter在web.xml中的配置顺序
- OpenSessionInViewFilter在web.xml中的配置
- 字符过滤器+在web.xml中的配置
- dwr在web.xml文件中的配置
- 机器人操作系统ros
- Gym 100204G Network Wars(最小割+0/1分数规划)
- 分布式Session的几种实现方式
- C++ 链表结构实站
- unity 报 out of sync 解决办法
- springmvc在web.xml中的常用配置
- 欢迎使用CSDN-markdown编辑器
- Linux
- jsp超链路径中带汉字以致找不到路径404的解决办法
- boost之asio实现定时器使用实例
- Java:单例设计模式
- 蓝牙的工作原理
- Tensorflow-gpu的错误
- ext简要描述