zoukankan      html  css  js  c++  java
  • web.xml配置

    在web.xml中init-param需配置在load-on-startup前面否则会报错

    <?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>itcast-usemanage</display-name>
        
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring/applicationContext*.xml</param-value>
        </context-param>
        
        <!--Spring的ApplicationContext 载入 -->
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        
        <!-- 编码过滤器,以UTF8编码 -->
        <filter>
            <filter-name>encodingFilter</filter-name>
            <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
            <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF8</param-value>
            </init-param>
        </filter>
        <filter-mapping>
            <filter-name>encodingFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <!-- 配置SpringMVC框架入口 -->
        <servlet>
            <servlet-name>itcast-usemanage</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>   
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>classpath:itcast-usemanage-servlet.xml</param-value>
            </init-param>
            <!--
                init-param需在load-on-startup的前面
             -->
            <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
            <servlet-name>itcast-usemanage</servlet-name>
            <!--
                此处可以用/,*.xxx,/xxx/*
                servlet不可以用/*
             -->
            <url-pattern>/rest/*</url-pattern>
        </servlet-mapping>
        
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>

    </web-app>

  • 相关阅读:
    hibernate 单元測试框架
    freemarker基本数据类型
    Effective C++:条款26:尽可能延后变量定义式的出现时间
    Hive Python Streaming的原理及写法
    算法(第四版)学习笔记之java实现希尔排序
    Passing address of non-local object to __autoreleasing parameter for write-back
    VB 中窗口发现冲突名称,将使用名称...怎么解决?
    struts2基础梳理(二)
    EM算法求高斯混合模型參数预计——Python实现
    Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layou
  • 原文地址:https://www.cnblogs.com/moaiwa/p/8150105.html
Copyright © 2011-2022 走看看