关于springMCV-spring-hibernate基础web.xml配置

    xiaoxiao2021-03-25  85

    <display-name>Archetype Created Web Application</display-name> <!-- springmvc post传参的乱码处理 --> <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> <!-- 1. 创建Spring的监听器 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 2. Spring的监听器通过context-param获取applicationContext.xml的位置 --> <context-param> <param-name>contextConfigLocation</param-name> <!-- applicationContext.xml的位置classpath默认在src/main/resouces下 --> <param-value>classpath:applicationContext.xml</param-value> </context-param> <!-- 指定springMVC servlet 用来响应所有.do为后缀的请求 --> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <!-- 指定spring配置文件名在src目录下 --> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <!-- 打开项目默认界面 --> <welcome-file-list> <welcome-file>login.do</welcome-file> </welcome-file-list>
    转载请注明原文地址: https://ju.6miu.com/read-15125.html

    最新回复(0)