<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>

web.xml中使用web前缀配置无法访问controller的更多相关文章

  1. JSP/JSF从web.xml中取出context-param的配置信息

    JSP/JSF从web.xml中取出context-param的配置信息. 应用场景:我们配置了项目的版本信息,想让他显示在页面上,如: <context-param><!-- ## ...

  2. Tomcat6和7版本对web.xml中taglib标签的配置差异

    原来部署在Tomcat6中的应用在Tomcat7中运行时报错如下错误: java.lang.IllegalArgumentException: taglib definition not consis ...

  3. web.xml中同一servlet/filter配置多个url-pattern

    转自:http://blog.sina.com.cn/s/blog_4c2c2a0c0100dh67.html 若你的servlet要多个地址,或你的filter需要过滤不同的url如有*.jsp,* ...

  4. web.xml的加载过程配置详解

      一:web.xml加载过程 简单说一下,web.xml的加载过程.当我们启动一个WEB项目容器时,容器包括(JBoss,Tomcat等).首先会去读取web.xml配置文件里的配置,当这一步骤没有 ...

  5. [转]web.xml中servlet ,filter ,listener ,interceptor的作用与区别

    原文链接:https://blog.csdn.net/netdevgirl/article/details/51483273 一.概念: 1.servlet:servlet是一种运行服务器端的java ...

  6. java的web.xml中<url-pattern>配置[转]

    <servlet-mapping> <servlet-name>downLoadFile</servlet-name> <url-pattern>*.l ...

  7. servlet中用注解的方式读取web.xml中的配置信息

    在学习servletContext的时候,我们知道了可以在web.xml中通过<context-param>标签来定义全局的属性(所有servlet都能读取的信息),并在servlet中通 ...

  8. web.xml中配置固定数据

    在web.xml单个servlet中配置的数据的存取 存: <servlet> <description>This is the description of my J2EE ...

  9. 在web.xml中配置error-page

    在web.xml中配置error-page 在web.xml中有两种配置error-page的方法,一是通过错误码来配置,而是通过异常的类型来配置,分别举例如下: 一.   通过错误码来配置error ...

随机推荐

  1. 用layui搭建的后台框架

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. Android直连SQL Server数据库

    1. 下载jtds,一个开放源代码的Java实现的JDBC驱动,地址:http://sourceforge.net/projects/jtds/ 2. 添加jtds到当前Android项目中,本人使用 ...

  3. Python-爬虫-猫眼T100

    目标站点需求分析 涉及的库 from multiprocessing import Poolfrom requests.exceptions import RequestExceptionimport ...

  4. Java二叉树的实现与特点

    二叉树是一种非常重要的数据结构,它同时具有数组和链表各自的特点:它可以像数组一样快速查找,也可以像链表一样快速添加.但是他也有自己的缺点:删除操作复杂. 我们先介绍一些关于二叉树的概念名词. 二叉树: ...

  5. LuoGu P1083 借教室

    题目传送门 借教室这个题有两种做法,差分+前缀和或者是线段树 线段树维护区间最小值,因为能不能借教室使用是由这几天中可用教室最少的一天决定的 其实这题是个很裸的线段树维护区间最小值,但有一点需要注意, ...

  6. FileStorage

    1. 函数说明                  功能 函数声明 参数 FileStorage构造函数 cv::FileStorage:: FileStorage(const String& ...

  7. swift 实践- 06 -- UITextView

    import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoa ...

  8. Confluence 6 从外部目录中同步数据配置同步间隔

    在用户目录(User Directories)界面中显示了最后的系统同步时间,包括有这次同步所花费的时间. 注意:针对 Crowd  和 Jira 目录同步时间的配置只在 Confluence 3.5 ...

  9. 三.NFS存储服务

    01. 课程回顾 备份服务概念介绍(rsync备份服务利用相应算法,实现增量数据同步) 备份服务工作方式说明: 1. 本地数据备份同步方式(类似cp命令) 2. 远程数据备份同步方式(类似scp命令) ...

  10. Java中Super和final关键字以及异常类

    1.final类不能有子类,也就谈不上继承的说法,如果用final修饰成员变量或者局部变量,那成了常量需要制定常量的值. 2.对象的上转型对象,上转型对象不能操作子类新增的成员变量,不能调用子类新增的 ...