Java蜘蛛人 歡迎大家
歡迎大家 來到我的blog , 如果我身邊的朋友 有什么不懂可以直接來問我 我會細心的幫助你的. 如果網絡上的朋友有什么不懂的 可以加我Java蜘蛛人 QQ48187537
posts - 54, comments - 192, trackbacks - 0, articles - 1
導航
BlogJava
首頁
新隨筆
聯系
聚合
管理
<
2008年8月
>
日
一
二
三
四
五
六
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(14)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2009年10月 (1)
2009年7月 (2)
2009年6月 (1)
2009年5月 (3)
2009年4月 (2)
2009年3月 (2)
2009年2月 (6)
2008年10月 (1)
2008年8月 (1)
2008年7月 (1)
2008年3月 (2)
2008年2月 (4)
2008年1月 (4)
2007年12月 (1)
2007年11月 (3)
2007年10月 (2)
2007年9月 (4)
2007年8月 (14)
文章檔案
2007年8月 (1)
搜索
最新評論
1.?re: JSP 整合 discuz 論壇 java蜘蛛人 -- 鄭成橋
siqishangshu@foxmail.com
求一份呀,謝謝了
--siqishangshu
2.?re: Spring 中的國際化
評論內容較長,點擊標題查看
--最代碼
3.?re: JSP 整合 discuz 論壇 java蜘蛛人 -- 鄭成橋
樓主 能發一份給我嗎?謝謝 1124376059@qq.com
--小里
4.?re: javaScript 實現樹型
評論內容較長,點擊標題查看
--lizhi
5.?re: Acegi視頻教程 (做權限管理的) 主講人: 鄭成橋
怎么地址錯誤 ,,,求大神發這相視頻給我,,QQ:461782455
--想要這個視頻
閱讀排行榜
1.?Spring 配置log4j(21003)
2.?webservice 視頻教程 Spring+xfire 整合 java蜘蛛人- 鄭成橋 (6865)
3.?Acegi視頻教程 (做權限管理的) 主講人: 鄭成橋 (5662)
4.?Eclipse開發JQuery環境設置(Spket)(5327)
5.?spring junit 測試 java蜘蛛人- 鄭成橋 (4478)
評論排行榜
1.?JSP 整合 discuz 論壇 java蜘蛛人 -- 鄭成橋(40)
2.?webservice 視頻教程 Spring+xfire 整合 java蜘蛛人- 鄭成橋 (23)
3.?Acegi視頻教程 (做權限管理的) 主講人: 鄭成橋 (14)
4.?Ext js 視頻 我今天下午講的(14)
5.?Spring 整合javamail 用 gmail 發送郵件(8)
spring 整合hibernate
Posted on 2008-08-14 14:52
Java蜘蛛人 --鄭成橋
閱讀(205)
評論(0)
編輯
收藏
首先 順序導入 spring hibernate struts
配置applicationContet.xml
<?
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 id
=
"
datasource
"
class
=
"
com.mchange.v2.c3p0.ComboPooledDataSource
"
destroy
-
method
=
"
close
"
>
<
property name
=
"
driverClass
"
value
=
"
com.microsoft.jdbc.sqlserver.SQLServerDriver
"
>
</
property
>
<
property name
=
"
jdbcUrl
"
value
=
"
jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=blog;SelectMethod=cursor
"
>
</
property
>
<
property name
=
"
user
"
value
=
"
sa
"
></
property
>
<
property name
=
"
password
"
value
=
"
sa
"
></
property
>
<
property name
=
"
minPoolSize
"
value
=
"
5
"
></
property
>
<
property name
=
"
maxPoolSize
"
value
=
"
20
"
></
property
>
<
property name
=
"
acquireIncrement
"
value
=
"
5
"
></
property
>
</
bean
>
<
bean id
=
"
sessionFactory
"
class
=
"
org.springframework.orm.hibernate3.LocalSessionFactoryBean
"
>
<
property name
=
"
dataSource
"
>
<
ref bean
=
"
datasource
"
/>
</
property
>
<
property name
=
"
hibernateProperties
"
>
<
props
>
<
prop key
=
"
hibernate.dialect
"
>
org.hibernate.dialect.SQLServerDialect
</
prop
>
<
prop key
=
"
hibernate.show_sql
"
>
true
</
prop
>
</
props
>
</
property
>
<
property name
=
"
mappingDirectoryLocations
"
>
<
list
>
<
value
>
classpath:
/
com
/
zcq
/
dao
</
value
>
</
list
>
</
property
>
</
bean
>
<!--
hibernateTemplate 配置
-->
<
bean id
=
"
hibernateTemplate
"
class
=
"
org.springframework.orm.hibernate3.HibernateTemplate
"
>
<
property name
=
"
sessionFactory
"
>
<
ref bean
=
"
sessionFactory
"
/>
</
property
>
</
bean
>
<!--
zcqbb datable
-->
<
bean id
=
"
daoimp
"
class
=
"
com.zcq.dao.Test
"
>
<
property name
=
"
hibernateTemplate
"
ref
=
"
hibernateTemplate
"
/>
</
bean
>
</
beans
>
然后寫接口
然后實現接口
package
com.zcq.job.dao;
import
org.springframework.context.ApplicationContext;
import
org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import
com.zcq.job.I.Zcq_I;
public
class
Zcq_Imp
extends
HibernateDaoSupport
implements
Zcq_I
{
public
void
show()
{
System.out.println(
"
sssssss
"
);
}
public
static
Zcq_I getApplication(ApplicationContext ctx)
{
return
(Zcq_I)ctx.getBean(
"
daoimp
"
);
}
}
web.xml 里加入
<
context
-
param
>
<
param
-
name
>
contextConfigLocation
</
param
-
name
>
<
param
-
value
>/
WEB
-
INF
/
applicationContext.xml
</
param
-
value
>
</
context
-
param
>
<
listener
>
<
listener
-
class
>
org.springframework.web.context.ContextLoaderListener
</
listener
-
class
>
</
listener
>
<
filter
>
<
filter
-
name
>
CharacterEncodingFilter
</
filter
-
name
>
<
filter
-
class
>
org.springframework.web.filter.CharacterEncodingFilter
</
filter
-
class
>
<
init
-
param
>
<
param
-
name
>
encoding
</
param
-
name
>
<
param
-
value
>
gbk
</
param
-
value
>
</
init
-
param
>
<
init
-
param
>
<
param
-
name
>
forceEncoding
</
param
-
name
>
<
param
-
value
>
true
</
param
-
value
>
</
init
-
param
>
</
filter
>
<
filter
-
mapping
>
<
filter
-
name
>
CharacterEncodingFilter
</
filter
-
name
>
<
url
-
pattern
>
/**/
/*
</url-pattern>
</filter-mapping>
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © Java蜘蛛人 --鄭成橋
主站蜘蛛池模板:
成年网在线观看免费观看网址
|
成人性生交大片免费看无遮挡
|
亚洲婷婷五月综合狠狠爱
|
美女被暴羞羞免费视频
|
国产免费131美女视频
|
久久综合亚洲色hezyo
|
国产精品免费小视频
|
理论秋霞在线看免费
|
亚洲成a人片在线观看国产
|
免费精品久久久久久中文字幕
|
www国产亚洲精品久久久日本
|
色老头综合免费视频
|
亚洲人成人77777网站
|
亚洲免费在线播放
|
亚洲国产高清美女在线观看
|
免费99精品国产自在现线
|
亚洲第一成年网站视频
|
国产又大又粗又硬又长免费
|
久久久久亚洲av无码专区蜜芽
|
蜜桃成人无码区免费视频网站
|
亚洲AV无码一区二区三区国产
|
欧洲乱码伦视频免费国产
|
区三区激情福利综合中文字幕在线一区亚洲视频1
|
午夜一级免费视频
|
男女猛烈激情xx00免费视频
|
亚洲夜夜欢A∨一区二区三区
|
国产免费爽爽视频在线观看
|
亚洲国产精品久久人人爱
|
国产黄色片在线免费观看
|
精品多毛少妇人妻AV免费久久
|
久久精品国产亚洲AV香蕉
|
成人啪精品视频免费网站
|
久久久免费观成人影院
|
亚洲综合小说久久另类区
|
在线精品免费视频
|
精品国产福利尤物免费
|
亚洲中文字幕无码一去台湾
|
av在线亚洲欧洲日产一区二区
|
91香焦国产线观看看免费
|
亚洲av无码一区二区三区四区
|
亚洲精品自在在线观看
|