和时间赛跑!
用心做事,诚信做人,超越自我,步步领先
登录
注册
全站
当前博客
空间
博客
好友
相册
论坛
留言
用户操作
[即时聊天]
[发私信]
[加为好友]
张钰
ID:ProvidenceZY
共
30142
次访问,排名
4123
,好友
104
人,关注者
115
人。
性格开朗,擅长沟通,热爱技术,自学能力强
ProvidenceZY的文章
原创 36 篇
翻译 0 篇
转载 5 篇
评论 40 篇
最近评论
hdnero:
wow gold
mawei_27:
要给ext源代码拷贝到项目下,并且目录为:plugins/extjs/ext-2.0
‘ext源代码’ 指的是什么啊 ,上面这句话谁能帮我详细解释 一下啊。
mawei_27:
这个怎么运行啊 我按着顺需都建在好了 其余的应该则么做啊
han0104:
路过
ltian999:
自私和贪婪是我们的本性,因为我们穷!我们必须劳动养家,没有闲暇时间去搞什么鸟开源。我们创造的利润大部分流到官僚买办贪污腐败者之手,我们能拿到的钱仅能养家糊口。所以开源是软件贵族的游戏,不是广大不同中国程序员所关心的,我们所关心的就是用好开源,做出产品养家糊口而以,因为我们无论如何也满足不了贪污腐败官僚买办阶层的胃口!
文章分类
程序设计
(RSS)
人生心得
(RSS)
软件工程
(RSS)
数据结构
(RSS)
数据库技术
(RSS)
算法驿站
(RSS)
团队发展
(RSS)
收藏
技术资料
相册
那时天好蓝!
朋友的Blog
CSDN
sql高手
算法
存档
2008年02月(1)
2008年01月(1)
2007年12月(2)
2007年11月(13)
2007年09月(2)
2007年08月(2)
2007年06月(1)
2007年03月(1)
2006年10月(11)
2006年08月(2)
2006年07月(4)
2006年06月(1)
软件项目交易
订阅我的博客
spring2.0 标签
收藏
新一篇: js获取本机信息
|
旧一篇: 详解Spring中bean的作用域
spring2.0
中支持
XML Schema
同时继续支持
dtd
,这样在
xml
配置文件中可以使用
dtd
和
schema
两种方式进行声明,示例如下:
spring2.0
及之前版本均支持
dtd
声明:
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"
>
<
beans
>
//这里是bean的配置
</
beans
>
spring2.0
及以后版本支持
schema
声明:
<?
xml version="1.0" encoding="UTF-8"
?>
<?
xml version="1.0" encoding="UTF-8"
?>
<
beans
xmlns
="http://www.springframework.org/schema/beans"
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-2.0.xsd"
>
//这里是bean的配置
</
beans
>
spring2.0
可以新增
<util>
标签进行扩充,使用
<util:list>
、
<util
:
map>
、
<util:set>
、
<util:properties>
等标签可以取代并简化集合的配置,下面就
4
种标签分别举例说明:
在使用
<util>
标签之前首先要给
xml
配置文件中加入
util
的命名空间,增加后的
spring
配置文件头如下:
<?
xml version="1.0" encoding="UTF-8"
?>
<?
xml version="1.0" encoding="UTF-8"
?>
<
beans
xmlns
="http://www.springframework.org/schema/beans"
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util
="http://www.springframework.org/schema/util"
xsi:schemaLocation
="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd "
>
……
</
beans
>
给上面的各种集合配置修改成
<util >
如下:
1
、
list
配置:
<!--
配置一个人物角色
-->
<
bean
id
="role"
class
="spring.chapter2.setDemo.Role"
>
<
property
name
="name"
value
="Mary"
/>
<
property
name
="health"
value
="100"
/>
<
property
name
="goods"
>
<
list
>
<
ref
bean
="medicine"
/>
<
ref
bean
="medicine1"
/>
</
list
>
</
property
>
</
bean
>
修改成
<util:list>
配置:
<!--
配置一个人物角色
-->
<
util:list
id
="medicinelist"
>
<
ref
bean
="medicine"
/>
<
ref
bean
="medicine1"
/>
</
util:list
>
<
bean
id
="role"
class
="spring.chapter2.setDemo.Role"
>
<
property
name
="name"
value
="Mary"
/>
<
property
name
="health"
value
="100"
/>
<
property
name
="goods"
ref
="medicinelist"
>
<util:list>
标签可以使用
list-class
来指定的
list
作为使用的集合对象:
<util:list id=
"medicinelist" list-class="java.util.ArrayList">
2
、
set
配置
<!--
配置一个人物角色
-->
<
bean
id
="role"
class
="spring.chapter2.setDemo.Role"
>
<
property
name
="name"
value
="Mary"
/>
<
property
name
="health"
value
="100"
/>
<
property
name
="goods"
>
<
set
>
<
ref
bean
="medicine"
/>
<
ref
bean
="medicine1"
/>
</
set
>
</
property
>
</
bean
>
修改成
<util:set>
配置:
<!--
配置一个人物角色
-->
<
util:set
id
="medicineset"
>
<
ref
bean
="medicine"
/>
<
ref
bean
="medicine1"
/>
</
util:set
>
<
bean
id
="role"
class
="spring.chapter2.setDemo.Role"
>
<
property
name
="name"
value
="Mary"
/>
<
property
name
="health"
value
="100"
/>
<
property
name
="goods"
ref
="medicineset"
/>
</
bean
>
<
util:set
>
标签也可以使用
set-class
来指定使用的集合容器对象:
<util:set id=
"medicineset" set-class="java.util.TreeSet"
>
3
、
map
配置
:
<!--
配置一个人物角色
-->
<
bean
id
="role"
class
="spring.chapter2.setDemo.Role"
>
<
property
name
="name"
value
="Mary"
/>
<
property
name
="health"
value
="100"
/>
<
property
name
="goods"
>
<
map
>
<
entry
key
="key1"
>
<
value
>
小药丸
</
value
>
</
entry
>
<
entry
key
="key2"
>
<
value
>
大药丸
</
value
>
</
entry
>
</
map
>
</
property
>
</
bean
>
修改成
<util:map>
配置:
<!--
配置一个人物角色
-->
<
util:map
id
="medicinemap"
>
<
entry
key
="key1"
value
="小药丸"
/>
<
entry
key
="key2"
value
="大药丸"
/>
</
util:map
>
<
bean
id
="role"
class
="spring.chapter2.setDemo.Role"
>
<
property
name
="name"
value
="Mary"
/>
<
property
name
="health"
value
="100"
/>
<
property
name
="goods"
ref
="medicinemap"
/>
</
bean
>
可以使用
map-class
来指定使用的集合对象
4
、
properties
配置:
<!--
配置一个人物角色
-->
<
bean
id
="role"
class
="spring.chapter2.setDemo.Role"
>
<
property
name
="name"
value
="Mary"
/>
<
property
name
="health"
value
="100"
/>
<
property
name
="goods"
>
<
props
>
<
propkey
="key1"
>
小药丸
</
prop
>
<
propkey
="key1"
>
大药丸
</
prop
>
</
props
>
</
property
>
</
bean
>
修改成
<util:properties>
配置如下:
<!--
配置一个人物角色
-->
<
util:properties
id
="medicineprops"
>
<
prop
key
="key1"
value
="小药丸"
/>
<
prop
key
="key1"
value
="大药丸"
/>
</
util:properties
>
<
bean
id
="role"
class
="spring.chapter2.setDemo.Role"
>
<
property
name
="name"
value
="Mary"
/>
<
property
name
="health"
value
="100"
/>
<
property
name
="goods"
ref
="medicineprops"
/>
</
bean
>
<util:properties>
可以使用
location
标签来载入外部
properties
文件:
<util:properties id=
"medicineprops" location="classpath:config.properties"/
>
发表于 @
2007年11月11日 22:03:00
|
评论(
loading...
)
|
编辑
新一篇: js获取本机信息
|
旧一篇: 详解Spring中bean的作用域
评论:没有评论。
发表评论
姓 名:
主 页:
校验码:
看不清,换一张
当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击
登录