Chinaunix首页 | 论坛 | 博客
  • 博客访问: 483780
  • 博文数量: 1496
  • 博客积分: 79800
  • 博客等级: 大将
  • 技术积分: 9940
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-09 13:22
文章分类

全部博文(1496)

文章存档

2011年(1)

2008年(1495)

我的朋友

分类:

2008-09-09 17:11:28

    前些日子看了一篇关于在Spring 2中整合DWR 2的文章《AJAX, DWR and Spring》。最近,想动手试一下,就其源代码回来看看,依葫芦画瓢做了一遍。在运行时,得到XML验证错误。经过一翻折腾,终于把问题解决。

    Spring 2基于XML Schema的配置
    众所周知,Spring 2通过XML Schema配置方式极大地简化的其配置,而且使得第三方扩展变为可能。配置如下代码所示:

   

     < beans xmlns =

         xmlns:xsi =

         xsi:schemaLocation =" " >

                 

         
    清单1 applicationContext.xml
    不知大家有没有想过spring-beans-2.0.xsd位置在那里?其实,大家可以用Eclipse打开Spring的jar包,展开META-INF,并双击打开其中的spring.schemas文件,内容如下:

    http\:// 2.0 .xsd = org/springframework/beans/factory/xml/spring-beans- 2.0 .xsd

     http\:// 2.0 .xsd = org/springframework/beans/factory/xml/spring-tool- 2.0 .xsd

     http\:// 2.0 .xsd = org/springframework/beans/factory/xml/spring-util- 2.0 .xsd

     http\:// 2.0 .xsd = org/springframework/aop/config/spring-aop- 2.0 .xsd

     http\:// 2.0 .xsd = org/springframework/scripting/config/spring-lang- 2.0 .xsd

     http\:// 2.0 .xsd = org/springframework/transaction/config/spring-tx- 2.0 .xsd

     http\:// 2.0 .xsd = org/springframework/ejb/config/spring-jee- 2.0 .xsd

     http\:// = org/springframework/beans/factory/xml/spring-beans- 2.0 .xsd

     http\:// = org/springframework/beans/factory/xml/spring-tool- 2.0 .xsd

     http\:// = org/springframework/beans/factory/xml/spring-util- 2.0 .xsd

     http\:// = org/springframework/aop/config/spring-aop- 2.0 .xsd

     http\:// = org/springframework/scripting/config/spring-lang- 2.0 .xsd

     http\:// = org/springframework/transaction/config/spring-tx- 2.0 .xsd

     http\:// = org/springframework/ejb/config/spring-jee- 2.0 .xsd

[1]   

【责编:landy】

--------------------next---------------------

阅读(114) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~