SpringMVC=>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_4_0.xsd" version="4.0"> <!--1.注册servlet--> <servlet> <servlet-name>SpringMVC</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <!--通过初始化参数指定SpringMVC配置文件的位置,进行关联--> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </init-param> <!-- 启动顺序,数字越小,启动越早 --> <load-on-startup>1</load-on-startup> </servlet> <!--所有请求都会被springmvc拦截 --> <servlet-mapping> <servlet-name>SpringMVC</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!--解决中文乱码问题--> <filter> <filter-name>encoding</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>encoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
相关推荐
zhongliwen 2020-06-13
方志朋 2020-05-30
JudeJoo 2020-08-21
牧场SZShepherd 2020-02-21
meleto 2020-08-15
zhangdy0 2020-05-06
neweastsun 2020-05-04
凯哥Java 2020-02-16
小鱿鱼 2020-02-14
牧场SZShepherd 2020-01-12
Julywhj 2020-01-11
玫瑰小妖 2020-07-18
dlutbob 2020-07-04
zmysna 2020-07-04
小鱿鱼 2020-06-26
MicroBoy 2020-06-17
zhongliwen 2020-06-13