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

    <web-app>
      <display-name>Archetype Created Web Application</display-name>
      <servlet>
          <servlet-name>ssm3</servlet-name>
          <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
          <init-param>
              <param-name>contextConfigLocation</param-name>
              <param-value>classpath*:servlet-context.xml</param-value>
          </init-param>
          <load-on-startup>1</load-on-startup>
      </servlet>
      
      <servlet-mapping>
          <servlet-name>ssm3</servlet-name>
          <url-pattern>/</url-pattern>
      </servlet-mapping>
      
      <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>classpath*:service-context.xml</param-value>
      </context-param>
    </web-app>

    这样写会报错:

    The content of element type "web-app" must match "(icon?,display-
    name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-
    mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-
    ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".

    要按顺序来写,调整context-param和servlet的顺序就可以了:

    <web-app>
        <display-name>Archetype Created Web Application</display-name>
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:service-context.xml</param-value>
        </context-param>
        
        <servlet>
            <servlet-name>ssm3</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>classpath*:servlet-context.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>ssm3</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
    </web-app>
  • 相关阅读:
    LTE问题集锦(0)
    LTE问题集锦(3)
    LTE问题集锦(2)
    LTE问题集锦(1)
    LTE学习之路(9)—— 3GPP TS协议系列总结
    (原创)我的测试生涯(2)——《Clearcase UCM Practice》
    我的测试生涯(1)——开篇《Clearcase简介》
    (转载)十年、五年,你该做的事
    (转载)Windows消息机制
    LTE学习之路(8)——信令流程
  • 原文地址:https://www.cnblogs.com/skyeyh/p/3829927.html
Copyright © 2011-2022 走看看