zhangjingqiang's Blog
BlogJava
首页
新随笔
新文章
联系
聚合
管理
posts - 5, comments - 0, trackbacks - 0
基于Ajax+Spring+Hibernate的用户管理系统--配置
applicationContext.xml
1
<?
xml version="1.0" encoding="UTF-8"
?>
2
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
3
"http://www.springframework.org/dtd/spring-beans.dtd"
>
4
5
<
beans
>
6
<
bean
id
="propertyConfigurer"
class
="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
7
<
property
name
="location"
value
="classpath:jdbc.properties"
/>
8
</
bean
>
9
10
<
bean
id
="txProxyTemplate"
abstract
="true"
11
class
="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
>
12
<
property
name
="transactionManager"
><
ref
bean
="transactionManager"
/></
property
>
13
<
property
name
="transactionAttributes"
>
14
<
props
>
15
<
prop
key
="save*"
>
PROPAGATION_REQUIRED
</
prop
>
16
<
prop
key
="remove*"
>
PROPAGATION_REQUIRED
</
prop
>
17
<
prop
key
="*"
>
PROPAGATION_REQUIRED,readOnly
</
prop
>
18
</
props
>
19
</
property
>
20
</
bean
>
21
22
<
bean
id
="userManager"
parent
="txProxyTemplate"
>
23
<
property
name
="target"
>
24
<
bean
class
="com.cn37signals.service.impl.UserManagerImpl"
>
25
<
property
name
="userDAO"
ref
="userDAO"
/>
26
</
bean
>
27
</
property
>
28
</
bean
>
29
</
beans
>
action-servlet.xml
1
<?
xml version="1.0" encoding="UTF-8"
?>
2
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
3
"http://www.springframework.org/dtd/spring-beans.dtd"
>
4
5
<
beans
>
6
<
bean
id
="exceptionResolver"
7
class
="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"
>
8
<
property
name
="exceptionMappings"
>
9
<
props
>
10
<
prop
key
="org.springframework.dao.DataAccessException"
>
11
dataAccessFailure
12
</
prop
>
13
</
props
>
14
</
property
>
15
</
bean
>
16
17
<
bean
id
="userController"
class
="com.cn37signals.web.UserController"
>
18
<
property
name
="userManager"
ref
="userManager"
/>
19
</
bean
>
20
21
<
bean
id
="userFormController"
class
="com.cn37signals.web.UserFormController"
>
22
<
property
name
="validator"
ref
="beanValidator"
/>
23
<
property
name
="formView"
value
="userForm"
/>
24
<
property
name
="successView"
value
="redirect:users.html"
/>
25
<
property
name
="userManager"
ref
="userManager"
/>
26
</
bean
>
27
28
29
<
bean
id
="viewResolver"
class
="org.springframework.web.servlet.view.InternalResourceViewResolver"
>
30
<
property
name
="viewClass"
value
="org.springframework.web.servlet.view.JstlView"
/>
31
<
property
name
="prefix"
value
="/"
/>
32
<
property
name
="suffix"
value
=".jsp"
/>
33
</
bean
>
34
35
<
bean
id
="urlMapping"
36
class
="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"
>
37
<
property
name
="mappings"
>
38
<
value
>
39
/users.html=userController
40
/editUser.html=userFormController
41
42
</
value
>
43
</
property
>
44
</
bean
>
45
46
<
bean
id
="messageSource"
class
="org.springframework.context.support.ResourceBundleMessageSource"
>
47
<
property
name
="basename"
value
="messages"
/>
48
</
bean
>
49
50
<
bean
id
="beanValidator"
class
="org.springmodules.commons.validator.DefaultBeanValidator"
>
51
<
property
name
="validatorFactory"
ref
="validatorFactory"
/>
52
</
bean
>
53
</
beans
>
applicationContext-hibernate.xml
1
<?
xml version="1.0" encoding="UTF-8"
?>
2
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
3
"http://www.springframework.org/dtd/spring-beans.dtd"
>
4
5
<
beans
>
6
<
bean
id
="dataSource"
class
="org.springframework.jdbc.datasource.DriverManagerDataSource"
>
7
<
property
name
="driverClassName"
value
="${jdbc.driverClassName}"
/>
8
<
property
name
="url"
value
="${jdbc.url}"
/>
9
<
property
name
="username"
value
="${jdbc.username}"
/>
10
<
property
name
="password"
value
="${jdbc.password}"
/>
11
</
bean
>
12
13
<
bean
id
="sessionFactory"
class
="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
>
14
<
property
name
="dataSource"
ref
="dataSource"
/>
15
<
property
name
="mappingResources"
>
16
<
list
>
17
<
value
>
com/cn37signals/model/User.hbm.xml
</
value
>
18
</
list
>
19
</
property
>
20
<
property
name
="hibernateProperties"
>
21
<
props
>
22
<
prop
key
="hibernate.dialect"
>
org.hibernate.dialect.PostgreSQLDialect
</
prop
>
23
<
prop
key
="hibernate.hbm2ddl.auto"
>
update
</
prop
>
24
</
props
>
25
</
property
>
26
</
bean
>
27
28
<
bean
id
="transactionManager"
class
="org.springframework.orm.hibernate3.HibernateTransactionManager"
>
29
<
property
name
="sessionFactory"
ref
="sessionFactory"
/>
30
</
bean
>
31
32
<
bean
id
="userDAO"
class
="com.cn37signals.dao.hibernate.UserDAOHibernate"
>
33
<
property
name
="sessionFactory"
ref
="sessionFactory"
/>
34
</
bean
>
35
</
beans
>
applicationContext-validation.xml
1
<?
xml version="1.0" encoding="UTF-8"
?>
2
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
3
"http://www.springframework.org/dtd/spring-beans.dtd"
>
4
5
<
beans
>
6
<
bean
id
="validatorFactory"
class
="org.springmodules.commons.validator.DefaultValidatorFactory"
>
7
<
property
name
="validationConfigLocations"
>
8
<
list
>
9
<
value
>
/WEB-INF/validation.xml
</
value
>
10
<
value
>
/WEB-INF/validator-rules.xml
</
value
>
11
</
list
>
12
</
property
>
13
</
bean
>
14
</
beans
>
validation.xml
1
<?
xml version="1.0" encoding="UTF-8"
?>
2
<!
DOCTYPE form-validation PUBLIC
3
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
4
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd"
>
5
6
<
form-validation
>
7
<
formset
>
8
<
form
name
="user"
>
9
<
field
property
="lastName"
depends
="required"
>
10
<
arg0
key
="user.lastName"
/>
11
</
field
>
12
</
form
>
13
</
formset
>
14
</
form-validation
>
jdbc.properties
1
jdbc.driverClassName=org.postgresql.Driver
2
jdbc.url=jdbc:postgresql://localhost/member
3
jdbc.username=postgres
4
jdbc.password=password
完整代码:
http://download.csdn.net/source/257855
posted on 2007-02-15 11:27
zhangjingqiang
阅读(692)
评论(0)
编辑
收藏
所属分类:
Hibernate
、
Spring
、
Ajax
新用户注册
刷新评论列表
只有注册用户
登录
后才能发表评论。
网站导航:
博客园
IT新闻
Chat2DB
C++博客
博问
管理
相关文章:
基于Ajax+Spring+Hibernate的用户管理系统--配置
基于Spring+Hibernate的网上广告管理系统--配置
基于Struts+Spring+Hibernate的Blog系统--配置
Struts+Spring+Hibernate集成简单配置
<
2007年2月
>
日
一
二
三
四
五
六
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
1
2
3
4
5
6
7
8
9
10
常用链接
我的随笔
我的评论
我的参与
留言簿
(1)
给我留言
查看公开留言
查看私人留言
随笔分类
Ajax(1)
Hibernate(4)
iBATIS(1)
Spring(5)
Struts(2)
WebWork(1)
随笔档案
2007年2月 (5)
收藏夹
技术博客(1)
友情链接
搜索
积分与排名
积分 - 3669
排名 - 3374
最新评论
阅读排行榜
1. Struts+Spring+Hibernate集成简单配置(1381)
2. 基于Ajax+Spring+Hibernate的用户管理系统--配置(692)
3. 基于Spring+WebWork+iBATIS的游戏装备交易系统--配置(664)
4. 基于Struts+Spring+Hibernate的Blog系统--配置(563)
5. 基于Spring+Hibernate的网上广告管理系统--配置(317)
评论排行榜
1. 基于Ajax+Spring+Hibernate的用户管理系统--配置(0)
2. 基于Spring+WebWork+iBATIS的游戏装备交易系统--配置(0)
3. 基于Spring+Hibernate的网上广告管理系统--配置(0)
4. 基于Struts+Spring+Hibernate的Blog系统--配置(0)
5. Struts+Spring+Hibernate集成简单配置(0)