• ssm整合之web.xml配置


    <?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_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>crm32</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>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>


    <!-- 配置spring -->
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring/applicationContext-*.xml</param-value>
    </context-param>

    <!-- 配置监听器加载spring -->
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>


    <!-- 配置过滤器,解决post的乱码问题 -->
    <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>
    <!-- 配置SpringMVC -->
    <servlet>
    <servlet-name>boot-crm</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring/springmvc.xml</param-value>
    </init-param>
    <!-- 配置springmvc什么时候启动,参数必须为整数 -->
    <!-- 如果为0或者大于0,则springMVC随着容器启动而启动 -->
    <!-- 如果小于0,则在第一次请求进来的时候启动 -->
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>boot-crm</servlet-name>
    <!-- 所有的请求都进入springMVC -->
    <url-pattern>/</url-pattern>

    <!--特别注意!!!

    拦截/*,这是一个错误的方式,请求可以走到Action中,但转到jsp时再次被拦截,不能访问到jsp,千万千万不能写拦截/*

    -->
    </servlet-mapping>


    </web-app>

  • 相关阅读:
    招聘面试—关于Mysql的一点儿总结
    情景linux—不曾了解的cat用法
    情景linux--shell如何实现多线程?
    情景linux--如何解决read命令产生的硬编码问题
    情景linux--如何优雅地退出telnet
    性能测试-概念篇-性能测试分类
    情景linux--如何摆脱深路径的频繁切换烦恼?
    TCP--telnet为何在127s后返回?
    你为什么必须(从现在开始就)掌握linux
    Cookie/Session机制详解
  • 原文地址:https://www.cnblogs.com/zjj1996/p/9100658.html
Copyright © 2020-2023  润新知