SSM框架项目web.xml模板

xiaoxiao2025-11-17  5

后期续补

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>ssm_01</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> <welcome-file>login.jsp</welcome-file> </welcome-file-list> <!-- 全局参数:spring的监听器读取此配置文件(多个配置文件用分号分隔) --> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:conf/spring.xml; classpath:conf/spring_mybatis.xml </param-value> </context-param> <!-- 初始化spring容器的监听器,会读取全局初始化的数据(xml配置文件) --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- spring的字符编码过滤器 --> <filter> <filter-name>encodingFilter</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>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- spring的请求转发Servlet。 spring mvc的入口,加载spring mvc前端控制器restful。 RESTful模式,必须在spring_mvc.xml中配置。 --> <servlet> <servlet-name>dispatcher_restful</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:conf/spring_mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher_restful</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
转载请注明原文地址: https://www.6miu.com/read-5039831.html

最新回复(0)