zoukankan      html  css  js  c++  java
  • web.xml中使用web前缀配置无法访问controller

    <web:context-param>
    <web:param-name>contextConfigLocation</web:param-name>
    <web:param-value>classpath:spring/applicationContext.xml</web:param-value>
    </web:context-param>

    <web:listener>
        <web:listener-class>org.springframework.web.context.ContextLoaderListener</web:listener-class>
        </web:listener>

    <web:listener>
    <web:listener-class>org.springframework.web.util.IntrospectorCleanupListener</web:listener-class>
    </web:listener>


    <web:servlet>
    <web:servlet-name>springmvc</web:servlet-name>
    <web:servlet-class>org.springframework.web.servlet.DispatcherServlet</web:servlet-class>
    <web:init-param>
    <web:param-name>contextConfigLocation</web:param-name>
    <web:param-value>classpath:spring/springmvc.xml</web:param-value>
    </web:init-param>
    <web:load-on-startup>1</web:load-on-startup>
    </web:servlet>
    <web:servlet-mapping>
    <web:servlet-name>springmvc</web:servlet-name>
    <web:url-pattern>/</web:url-pattern>
    </web:servlet-mapping>
    使用上面这种配置是不行的。

    把web: 去掉

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring/applicationContext.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

    <listener>
    <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
    </listener>


    <servlet>
    <servlet-name>springmvc</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>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>/</url-pattern>
    </servlet-mapping>

  • 相关阅读:
    Sql ISNULL() 函数
    C#WinForm中按钮响应回车事件的简单方法
    职场升迁全攻略 人脉资源是铺垫
    怎样成为有钱人
    睡前应做六件事
    赚钱的秘诀(转)
    将Win2003转换成个人PC版系统
    抠图神器Inpaint 4.2
    iPhone升级记:从4.3.3到5.0.1:越狱篇
    iPhone升级记:从4.3.3到5.0.1:弯路篇
  • 原文地址:https://www.cnblogs.com/lirenhe/p/9774462.html
Copyright © 2011-2022 走看看