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>
  • 相关阅读:
    【整数划分系列】
    【51nod-1183】编辑距离
    【河南第十届省赛-D】年终奖金
    【河南第十届省赛-B】情报传递
    【河南省第十届ACM 省赛 A-谍报分析】
    Node.js函数介绍(参数为一个函数)
    Webstorm设置Node.js智能提示
    TortoiseSVN服务器ip地址修改后如何使用
    vue项目组件的全局注册
    ES6 类(Class)基本用法和静态属性+方法详解
  • 原文地址:https://www.cnblogs.com/skyeyh/p/3829927.html
Copyright © 2011-2022 走看看