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"
7 class ="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
8 < property name ="location" value ="classpath:jdbc.properties" />
9 </ bean >
10
11 <!-- Transaction template for Managers, from:
12 http://blog.exis.com/colin/archives/2004/07/31/concise-transaction-definitions-spring-11/ -->
13 < bean id ="txProxyTemplate" abstract ="true"
14 class ="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" >
15 < property name ="transactionManager" >
16 < ref bean ="transactionManager" />
17 </ property >
18 < property name ="transactionAttributes" >
19 < props >
20 < prop key ="save*" > PROPAGATION_REQUIRED </ prop >
21 < prop key ="remove*" > PROPAGATION_REQUIRED </ prop >
22 < prop key ="*" > PROPAGATION_REQUIRED,readOnly </ prop >
23 </ props >
24 </ property >
25 </ bean >
26
27 < bean id ="userManager" parent ="txProxyTemplate" >
28 < property name ="target" >
29 < bean class ="com.mygame.service.impl.UserManagerImpl" >
30 < property name ="userDAO" ref ="userDAO" />
31 </ bean >
32 </ property >
33 </ bean >
34 <!-- Area-START -->
35 < bean id ="areaManager" parent ="txProxyTemplate" >
36 < property name ="target" >
37 < bean class ="com.mygame.service.impl.AreaManagerImpl" >
38 < property name ="areaDao" ref ="areaDao" />
39 </ bean >
40 </ property >
41 </ bean >
42 <!-- Area-END -->
43 <!-- Game-START -->
44 < bean id ="gameManager" parent ="txProxyTemplate" >
45 < property name ="target" >
46 < bean class ="com.mygame.service.impl.GameManagerImpl" >
47 < property name ="gameDao" ref ="gameDao" />
48 </ bean >
49 </ property >
50 </ bean >
51 <!-- Game-END -->
52 <!-- Player-START -->
53 < bean id ="playerManager" parent ="txProxyTemplate" >
54 < property name ="target" >
55 < bean class ="com.mygame.service.impl.PlayerManagerImpl" >
56 < property name ="playerDao" ref ="playerDao" />
57 </ bean >
58 </ property >
59 </ bean >
60 <!-- Player-END -->
61 <!-- Sale-START -->
62 < bean id ="saleManager" parent ="txProxyTemplate" >
63 < property name ="target" >
64 < bean class ="com.mygame.service.impl.SaleManagerImpl" >
65 < property name ="saleDao" ref ="saleDao" />
66 </ bean >
67 </ property >
68 </ bean >
69 <!-- Sale-END -->
70 <!-- Server-START -->
71 < bean id ="serverManager" parent ="txProxyTemplate" >
72 < property name ="target" >
73 < bean class ="com.mygame.service.impl.ServerManagerImpl" >
74 < property name ="serverDao" ref ="serverDao" />
75 </ bean >
76 </ property >
77 </ bean >
78 <!-- Server-END -->
79
80 </ 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 ="userAction" class ="com.mygame.web.UserAction"
7 singleton ="false" >
8 < property name ="userManager" ref ="userManager" />
9 </ bean >
10 <!-- Game-START -->
11 < bean id ="gameAction" class ="com.mygame.web.GameAction"
12 singleton ="false" >
13 < property name ="gameManager" ref ="gameManager" />
14 </ bean >
15 <!-- Game-END -->
16 <!-- Area-START -->
17 < bean id ="areaAction" class ="com.mygame.web.AreaAction"
18 singleton ="false" >
19 < property name ="areaManager" ref ="areaManager" />
20 </ bean >
21 <!-- Area-END -->
22 <!-- Server-START -->
23 < bean id ="serverAction" class ="com.mygame.web.ServerAction"
24 singleton ="false" >
25 < property name ="serverManager" ref ="serverManager" />
26 </ bean >
27 <!-- Server-END -->
28 <!-- Sale-START -->
29 < bean id ="saleAction" class ="com.mygame.web.SaleAction"
30 singleton ="false" >
31 < property name ="saleManager" ref ="saleManager" />
32 </ bean >
33 <!-- Sale-END -->
34 <!-- Player-START -->
35 < bean id ="playerAction" class ="com.mygame.web.PlayerAction"
36 singleton ="false" >
37 < property name ="playerManager" ref ="playerManager" />
38 </ bean >
39 <!-- Player-END -->
40 </ beans >
applicationContext-ibatis.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"
7 class ="org.apache.commons.dbcp.BasicDataSource"
8 destroy-method ="close" >
9 < property name ="driverClassName"
10 value ="${jdbc.driverClassName}" />
11 < property name ="url" value ="${jdbc.url}" />
12 < property name ="username" value ="${jdbc.username}" />
13 < property name ="password" value ="${jdbc.password}" />
14 < property name ="maxActive" value ="30" />
15 < property name ="maxIdle" value ="10" />
16 < property name ="maxWait" value ="1000" />
17 < property name ="defaultAutoCommit" value ="true" />
18 </ bean >
19
20 <!-- Transaction manager for iBATIS DAOs -->
21 < bean id ="transactionManager"
22 class ="org.springframework.jdbc.datasource.DataSourceTransactionManager" >
23 < property name ="dataSource" ref ="dataSource" />
24 </ bean >
25
26 <!-- SqlMap setup for iBATIS Database Layer -->
27 < bean id ="sqlMapClient"
28 class ="org.springframework.orm.ibatis.SqlMapClientFactoryBean" >
29 < property name ="dataSource" ref ="dataSource" />
30 < property name ="configLocation"
31 value ="classpath:/com/mygame/dao/ibatis/sql-map-config.xml" />
32 </ bean >
33
34 < bean id ="userIncrementer"
35 class ="org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer" >
36 < property name ="dataSource" ref ="dataSource" />
37 < property name ="incrementerName" value ="user_sequence" />
38 <!-- property name="columnName"><value>value</value></property -->
39 </ bean >
40
41 < bean id ="userDAO" class ="com.mygame.dao.ibatis.UserDAOiBatis" >
42 < property name ="incrementer" ref ="userIncrementer" />
43 < property name ="sqlMapClient" ref ="sqlMapClient" />
44 </ bean >
45 <!-- Area-START -->
46 < bean id ="areaDao" class ="com.mygame.dao.ibatis.AreaDaoiBatis" >
47 < property name ="dataSource" ref ="dataSource" />
48 < property name ="sqlMapClient" ref ="sqlMapClient" />
49 </ bean >
50 <!-- Area-END -->
51 <!-- Game-START -->
52 < bean id ="gameDao" class ="com.mygame.dao.ibatis.GameDaoiBatis" >
53 < property name ="dataSource" ref ="dataSource" />
54 < property name ="sqlMapClient" ref ="sqlMapClient" />
55 </ bean >
56 <!-- Game-END -->
57 <!-- Player-START -->
58 < bean id ="playerDao"
59 class ="com.mygame.dao.ibatis.PlayerDaoiBatis" >
60 < property name ="dataSource" ref ="dataSource" />
61 < property name ="sqlMapClient" ref ="sqlMapClient" />
62 </ bean >
63 <!-- Player-END -->
64 <!-- Sale-START -->
65 < bean id ="saleDao" class ="com.mygame.dao.ibatis.SaleDaoiBatis" >
66 < property name ="dataSource" ref ="dataSource" />
67 < property name ="sqlMapClient" ref ="sqlMapClient" />
68 </ bean >
69 <!-- Sale-END -->
70 <!-- Server-START -->
71 < bean id ="serverDao"
72 class ="com.mygame.dao.ibatis.ServerDaoiBatis" >
73 < property name ="dataSource" ref ="dataSource" />
74 < property name ="sqlMapClient" ref ="sqlMapClient" />
75 </ bean >
76 <!-- Server-END -->
77 <!-- Add additional DAO definitions here -->
78 </ beans >
jdbc.properties
1 jdbc.driverClassName=org.postgresql.Driver
2 jdbc.url=jdbc:postgresql://localhost/37game
3 jdbc.username=postgres
4 jdbc.password=password
jdbc.properties.mysql
1 jdbc.driverClassName=com.mysql.jdbc.Driver
2 jdbc.url=jdbc:mysql://localhost/equinox?createDatabaseIfNotExist=true
3 jdbc.username=root
4 jdbc.password=
webwork.properties
1 # http://www.opensymphony.com/webwork/wikidocs/webwork.properties.html
2
3 webwork.objectFactory=spring
4 webwork.action.extension=html
5 webwork.custom.i18n.resources=messages
6 webwork.multipart.maxSize=2097152
7
8 ### when set to true, WebWork will act much more friendly for developers. This
9 ### includes:
10 ### - webwork.i18n.reload = true
11 ### - webwork.configuration.xml.reload = true
12 ### - raising various debug or ignorable problems to errors
13 ### For example: normally a request to foo.action?someUnknownField=true should
14 ### be ignored (given that any value can come from the web and it
15 ### should not be trusted). However, during development, it may be
16 ### useful to know when these errors are happening and be told of
17 ### them right away.
18 webwork.devMode=false
19
20 ### Configuration reloading
21 ### This will cause the configuration to reload xwork.xml when it is changed
22 webwork.configuration.xml.reload=true
23
24 ### workaround for some app servers that don't handle HttpServletRequest.getParameterMap()
25 ### often used for WebLogic, Orion, and OC4J
26 # webwork.dispatcher.parametersWorkaround = false
xwork.xml
1 <! DOCTYPE xwork PUBLIC
2 "-//OpenSymphony Group//XWork 1.1.1//EN"
3 "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd" >
4
5 < xwork >
6 <!-- Include webwork defaults (from WebWork JAR) -->
7 < include file ="webwork-default.xml" />
8
9 <!-- Configuration for the default package. -->
10 < package name ="default" extends ="webwork-default" >
11 < interceptors >
12 < interceptor-stack name ="defaultStack" >
13 < interceptor-ref name ="exception" />
14 < interceptor-ref name ="alias" />
15 < interceptor-ref name ="servlet-config" />
16 < interceptor-ref name ="prepare" />
17 < interceptor-ref name ="i18n" />
18 < interceptor-ref name ="chain" />
19 < interceptor-ref name ="model-driven" />
20 < interceptor-ref name ="fileUpload" />
21 < interceptor-ref name ="static-params" />
22 < interceptor-ref name ="params" />
23 < interceptor-ref name ="conversionError" />
24 < interceptor-ref name ="validation" >
25 < param name ="excludeMethods" >
26 cancel,execute,delete,edit,list
27 </ param >
28 </ interceptor-ref >
29 < interceptor-ref name ="workflow" >
30 < param name ="excludeMethods" >
31 input,back,cancel
32 </ param >
33 </ interceptor-ref >
34 </ interceptor-stack >
35 </ interceptors >
36
37 < global-results >
38 < result name ="dataAccessFailure" >
39 dataAccessFailure.jsp
40 </ result >
41 </ global-results >
42
43 < global-exception-mappings >
44 < exception-mapping
45 exception ="org.springframework.dao.DataAccessException"
46 result ="dataAccessFailure" />
47 </ global-exception-mappings >
48
49 <!-- List of Users -->
50 < action name ="users" class ="userAction" method ="list" >
51 < result name ="success" > userList.jsp </ result >
52 < result name ="input" > userList.jsp </ result >
53 </ action >
54
55 <!-- Edit User -->
56 < action name ="editUser" class ="userAction" method ="edit" >
57 < result name ="success" > userForm.jsp </ result >
58 < result name ="input" > userList.jsp </ result >
59 </ action >
60
61 <!-- Save User -->
62 < action name ="saveUser" class ="userAction" >
63 < result name ="cancel" type ="redirect" > users.html </ result >
64 < result name ="delete" type ="redirect" > users.html </ result >
65 < result name ="input" > userForm.jsp </ result >
66 < result name ="success" type ="chain" >
67 saveUserWithValidation
68 </ result >
69 </ action >
70
71 < action name ="saveUserWithValidation" class ="userAction"
72 method ="save" >
73 < result name ="input" > userForm.jsp </ result >
74 < result name ="success" type ="redirect" > users.html </ result >
75 </ action >
76
77 <!-- List of Areas -->
78 < action name ="areas" class ="areaAction" method ="list" >
79 < result name ="success" > areaList.jsp </ result >
80 < result name ="input" > areaList.jsp </ result >
81 </ action >
82
83 <!-- Edit Area -->
84 < action name ="editArea" class ="areaAction" method ="edit" >
85 < result name ="success" > areaForm.jsp </ result >
86 < result name ="input" > areaList.jsp </ result >
87 </ action >
88
89 <!-- Save Area -->
90 < action name ="saveArea" class ="areaAction" >
91 < result name ="cancel" type ="redirect" > areas.html </ result >
92 < result name ="delete" type ="redirect" > areas.html </ result >
93 < result name ="input" > areaForm.jsp </ result >
94 < result name ="success" type ="chain" >
95 saveAreaWithValidation
96 </ result >
97 </ action >
98
99 < action name ="saveAreaWithValidation" class ="areaAction"
100 method ="save" >
101 < result name ="input" > areaForm.jsp </ result >
102 < result name ="success" type ="redirect" > areas.html </ result >
103 </ action >
104
105 <!-- List of Games -->
106 < action name ="games" class ="gameAction" method ="list" >
107 < result name ="success" > gameList.jsp </ result >
108 < result name ="input" > gameList.jsp </ result >
109 </ action >
110
111 <!-- Edit Game -->
112 < action name ="editGame" class ="gameAction" method ="edit" >
113 < result name ="success" > gameForm.jsp </ result >
114 < result name ="input" > gameList.jsp </ result >
115 </ action >
116
117 <!-- Save Game -->
118 < action name ="saveGame" class ="gameAction" >
119 < result name ="cancel" type ="redirect" > games.html </ result >
120 < result name ="delete" type ="redirect" > games.html </ result >
121 < result name ="input" > gameForm.jsp </ result >
122 < result name ="success" type ="chain" >
123 saveGameWithValidation
124 </ result >
125 </ action >
126
127 < action name ="saveGameWithValidation" class ="gameAction"
128 method ="save" >
129 < result name ="input" > gameForm.jsp </ result >
130 < result name ="success" type ="redirect" > games.html </ result >
131 </ action >
132
133 <!-- List of Servers -->
134 < action name ="servers" class ="serverAction" method ="list" >
135 < result name ="success" > serverList.jsp </ result >
136 < result name ="input" > serverList.jsp </ result >
137 </ action >
138
139 <!-- Edit Server -->
140 < action name ="editServer" class ="serverAction" method ="edit" >
141 < result name ="success" > serverForm.jsp </ result >
142 < result name ="input" > serverList.jsp </ result >
143 </ action >
144
145 <!-- Save Server -->
146 < action name ="saveServer" class ="serverAction" >
147 < result name ="cancel" type ="redirect" > servers.html </ result >
148 < result name ="delete" type ="redirect" > servers.html </ result >
149 < result name ="input" > serverForm.jsp </ result >
150 < result name ="success" type ="chain" >
151 saveServerWithValidation
152 </ result >
153 </ action >
154
155 < action name ="saveServerWithValidation" class ="serverAction"
156 method ="save" >
157 < result name ="input" > serverForm.jsp </ result >
158 < result name ="success" type ="redirect" > servers.html </ result >
159 </ action >
160
161 <!-- List of Players -->
162 < action name ="players" class ="playerAction" method ="list" >
163 < result name ="success" > playerList.jsp </ result >
164 < result name ="input" > playerList.jsp </ result >
165 </ action >
166
167 <!-- Edit Player -->
168 < action name ="editPlayer" class ="playerAction" method ="edit" >
169 < result name ="success" > playerForm.jsp </ result >
170 < result name ="input" > playerList.jsp </ result >
171 </ action >
172
173 <!-- Save Player -->
174 < action name ="savePlayer" class ="playerAction" >
175 < result name ="cancel" type ="redirect" > players.html </ result >
176 < result name ="delete" type ="redirect" > players.html </ result >
177 < result name ="input" > playerForm.jsp </ result >
178 < result name ="success" type ="chain" >
179 savePlayerWithValidation
180 </ result >
181 </ action >
182
183 < action name ="savePlayerWithValidation" class ="playerAction"
184 method ="save" >
185 < result name ="input" > playerForm.jsp </ result >
186 < result name ="success" type ="redirect" > players.html </ result >
187 </ action >
188 <!-- List of Sales -->
189 < action name ="sales" class ="saleAction" method ="list" >
190 < result name ="success" > saleList.jsp </ result >
191 < result name ="input" > saleList.jsp </ result >
192 </ action >
193
194 <!-- Edit Sale -->
195 < action name ="editSale" class ="saleAction" method ="edit" >
196 < result name ="success" > saleForm.jsp </ result >
197 < result name ="input" > saleList.jsp </ result >
198 </ action >
199
200 <!-- Save Sale -->
201 < action name ="saveSale" class ="saleAction" >
202 < result name ="cancel" type ="redirect" > sales.html </ result >
203 < result name ="delete" type ="redirect" > sales.html </ result >
204 < result name ="input" > saleForm.jsp </ result >
205 < result name ="success" type ="chain" >
206 saveSaleWithValidation
207 </ result >
208 </ action >
209
210 < action name ="saveSaleWithValidation" class ="saleAction"
211 method ="save" >
212 < result name ="input" > saleForm.jsp </ result >
213 < result name ="success" type ="redirect" > sales.html </ result >
214 </ action >
215
216 </ package >
217 </ xwork >
完整代码:
http://download.csdn.net/source/257861
posted on 2007-02-15 11:07
zhangjingqiang 阅读(664)
评论(0) 编辑 收藏 所属分类:
Spring 、
WebWork 、
iBATIS