在动态web项目(Dynamic Web Project)中,使用SpringMVC框架,新建Spring的配置文件springmvc.xml,添加扫描控制器

<context:component-scan base-package="com.bwlu.controller"/>

显示红线

此时启动tomcat显示如下错误,元素 "context:component-scan" 的前缀 "context" 未绑定

解决方案:

1、在springmvc.xml中添加context的声明,添加后红线消失

此时启动tomcat,显示如下错误:通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。

2、在xsi:schemaLocation实例中引用模式文档,指出模式文档的位置

完整代码如下:

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 扫描器 -->
<context:component-scan base-package="com.bwlu.controller"/>
<!-- 视图解析器 解析jsp视图 默认使用JSTL标签 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置jsp路径的前缀 -->
<property name="prefix" value="/WEB-INF/views/" />
<!-- 配置jsp路径的后缀 -->
<property name="suffix" value=".jsp" />
</bean>
</beans>

元素 "context:component-scan" 的前缀 "context" 未绑定的解决方案的更多相关文章

  1. context:component-scan" 的前缀 "context" 未绑定。

    SpElUtilTest.testSpELLiteralExpressiontestSpELLiteralExpression(cn.zr.spring.spel.SpElUtilTest)org.s ...

  2. spring配置事务 元素 "tx:annotation-driven" 的前缀 "tx" 未绑定

    在进行spring与mybatis整合时,启动项目报错,控制台提示“元素 "tx:annotation-driven" 的前缀 "tx" 未绑定”. 经过查找, ...

  3. cache:annotation-driven" 的前缀 "cache" 未绑定

    问题: Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 29 in XML ...

  4. [Spring Boot] Use Component Scan to scan for Bean

    Component Scan is important concept when we want to create Bean. Currently we know what, for the cla ...

  5. [转载]Context and Interception : The .NET Context

    转载自:Context and Interception : The .NET Context Every new app domain starts with a single context, c ...

  6. Android在Context详细解释 ---- 你不知道Context

                                                                                                         ...

  7. spring注解注入:<context:component-scan>以及其中的context:include-filter>和 <context:exclude-filter>的是干什么的?

    转自:https://www.cnblogs.com/vanl/p/5733655.html spring注解注入:<context:component-scan>使用说明   sprin ...

  8. 为什么applicationContext.xml和spring-servlet.xml中都有注解过滤<context:component-scan base-package="myproject"> 和<context:component-scan base-package="myproject.controller" />

    在刚学习SpringMVC框架整合时,你也许会产生疑问为什么Spring.xml和SpringMVC.xml中都有注解过滤. <context:component-scan base-packa ...

  9. <context:component-scan>子标签:<context:include-filter>和<context:exclude-filter>使用时要注意的地方

    在Spring MVC中的配置中一般会遇到这两个标签,作为<context:component-scan>的子标签出现. 但在使用时要注意一下几点: 1.在很多配置中一般都会吧Spring ...

随机推荐

  1. MySQL索引使用:字段为varchar类型时,条件要使用''包起来

    结论: 当MySQL中字段为int类型时,搜索条件where num='111' 与where num=111都可以使用该字段的索引.当MySQL中字段为varchar类型时,搜索条件where nu ...

  2. ios中的coredata

    本文转载至 http://blog.csdn.net/chen505358119/article/details/9334831 分类: ios2013-07-15 18:12 12449人阅读 评论 ...

  3. java用iText导出word文档

    1.需要导入的jar包 2.导出word并下载其实是分两步的. 第一步是将需要导出的数据导出(上传)到服务器上 第二步是将服务器上的文档下载到本地 3. 第一步.上传文档 (1)设置响应信息以及构造上 ...

  4. svn 更新文件冲突,提示中文乱码解决

    问题描述: update 操作提示错误信息,中文乱码 和 “Please execute the 'Cleanup' command.” Cleanup 操作报错: 解决办法: 1. 工具下载(sql ...

  5. EasyGBS国标流媒体视频平台接入海康、大华、宇视的摄像机、硬盘录像机NVR、国标下级平台的方案

    在上一篇<EasyNVR和EasyDSS云平台联手都不能解决的事情,只有国标GB28181能解决了>我们大致介绍了国标GB/T28181的使用场景,而且初步介绍了EasyGBS国标视频平台 ...

  6. 封装AFNetworking

    用了一下AFNetworking感觉比ASIHttprequest 真心好用一些,因为我还是个初学者吧,很多ASIHttprequest 的功能还没有用到,与ASIHttprequest 不用的是AF ...

  7. iOS 多线程之 NSThread的基本使用

    一个NSThread对象就代表一条线程 下面是NSThread开启线程的方法 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEv ...

  8. javascript实例:显示时间

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

  9. OC、C#与JAVA语法特点一些异同(差集&交集)

    C#对JAVA: 1.扩展方法 2.部分类 3.动态对象 4.匿名返回类型 5.表达式树 6.Linq 7.没有函数指针,委托,事件的直接提供方式 8.JAVA接口不规定以I开头,这个很烂的思想! J ...

  10. IT basic knowledge

    LAMP: Linux Apache MySQL PHP URL & URI: 统一资源定位符是统一资源标志符的一个下种.统一资源标志符确定一个资源,而统一资源定位符不但确定一个资源, 而且还 ...