<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. Maven多模块项目加载

      Maven多模块项目中如何让Spring运行时成功加载指定的子模块   将子模块pom加入到父模块pom的定义中,并继承父模块   在web.xml中配置加载子模块的Spring配置文件   在启 ...

  2. 常见的SQL调优(SQL Tuning)Tips

    建立适当的索引(参考<正确建立数据库索引的姿势>)   用UNION替换OR (适用于索引列)   用exist.not exist代替 in.not in   不要以字符格式声明数字(会 ...

  3. 安装python的pip模块

    安装python的pip模块 网址https://pypi.python.org/pypi/pip 选择,点击下载 将文件解压到C:\Users\Administrator\AppData\Local ...

  4. Oracle数据库内存使用情况分析查看

    SGA.PGA使用情况 select name,total,round(total-free,2) used, round(free,2) free,round((total-free)/total* ...

  5. Confluence 6 自定义默认空间内容

    中文标题[自定义默认空间内容] Confluence 管理员 可以编辑用于创建主页和新站点的模板.默认的内容将会在新空间创建后的主页上显示出来.这个与站点空间,个人空间和空间蓝图的模板是不同的. 模板 ...

  6. 小学生都看得懂的C语言入门(1): 基础/判别/循环

    c基础入门, 小学生也可以都看得懂!!!! 安装一个编译器, 这方面我不太懂, 安装了DEV-C++  ,体积不大,30M左右吧, 感觉挺好用,初学者够了. 介绍下DEV 的快键键: 恢复 Ctrl+ ...

  7. Git的常见基础操作命令

    Git的常见基础操作命令 1安装初始化 1.1安装git本地安装Windows版本 下载地址: https://git-scm.com/downloads/ 1.2初始化Git用户信息配置 配置git ...

  8. SQLServer索引及统计信息

    索引除了提高性能,还能维护数据库. 索引是一种存储结构,主要以B-Tree形式存储信息. B-Tree的定义: 1.每个节点最多只有m个节点(m>=2) 2.除了根节点和叶子节点外的每个节点上最 ...

  9. Facebook的React Native之所以能打败谷歌的原因有7个(ReactNative vs Flutter)

    https://baijiahao.baidu.com/s?id=1611028483072699113&wfr=spider&for=pc 如果你喜欢用(或希望能够用)模板搭建应用, ...

  10. 一脸懵逼学习Hive的元数据库Mysql方式安装配置

    1:要想学习Hive必须将Hadoop启动起来,因为Hive本身没有自己的数据管理功能,全是依赖外部系统,包括分析也是依赖MapReduce: 2:七个节点跑HA集群模式的: 第一步:必须先将Zook ...