質問編集履歴

4

お手上げ

2017/04/25 05:13

投稿

exten
exten

スコア15

test CHANGED
File without changes
test CHANGED
@@ -311,3 +311,31 @@
311
311
  }
312
312
 
313
313
  ```
314
+
315
+ 追記3
316
+
317
+ 教えて頂いたサンプルを作ってみたりしているのですが、Diconのパスを指定するところで、リソースが見つかりません【ESSR0055】エラーコード
318
+
319
+ が出てきている状況で処理がサンプルも、本題も同じエラーで進めれず止まってしまいます。
320
+
321
+ ディレクトリはあってるはず。。
322
+
323
+ 質問するには、理解が浅くご迷惑おかけしました。
324
+
325
+
326
+
327
+ ```
328
+
329
+ dao
330
+
331
+
332
+
333
+ // 設定ファイルのPath
334
+
335
+ private static final String PATH = "test/src/main/resources/s2Dao.dicon";
336
+
337
+ // 設定ファイルを読み込む Eclipseのデバッグでここでエラーを吐く
338
+
339
+ S2Container container = S2ContainerFactory.create(PATH);
340
+
341
+ ```

3

誤字修正

2017/04/25 05:12

投稿

exten
exten

スコア15

test CHANGED
File without changes
test CHANGED
@@ -140,7 +140,7 @@
140
140
 
141
141
 
142
142
 
143
- import tea.entity.Product;
143
+ import product.entity.Product;
144
144
 
145
145
 
146
146
 

2

実装中のコードとかです

2017/04/24 02:37

投稿

exten
exten

スコア15

test CHANGED
File without changes
test CHANGED
@@ -88,7 +88,7 @@
88
88
 
89
89
  ```
90
90
 
91
- 04/17追記
91
+ 追記1
92
92
 
93
93
  s2Dao.diconが自動生成されてなかった(自作しないといけない?)
94
94
 
@@ -103,3 +103,211 @@
103
103
 
104
104
 
105
105
  s2Dao.diconを作成について調査中です。
106
+
107
+
108
+
109
+ 追記2
110
+
111
+ 途中ですが、一回追記します。
112
+
113
+ S2DaoでSQLをどう生成したらよいのかもわからないままです
114
+
115
+ actionのmainの処理もできていません。
116
+
117
+ このサイトわかりやすいよ。とかそういうのありましたら
118
+
119
+ 教えて頂けないでしょうか。。。
120
+
121
+ 以下は今書いてる途中のものです。
122
+
123
+
124
+
125
+ ```
126
+
127
+ DAO
128
+
129
+
130
+
131
+ package product.dao;
132
+
133
+
134
+
135
+ import java.util.List;
136
+
137
+
138
+
139
+ import org.seasar.dao.annotation.tiger.S2Dao;
140
+
141
+
142
+
143
+ import tea.entity.Product;
144
+
145
+
146
+
147
+ @S2Dao(bean=Tea.class)
148
+
149
+ public interface ProductDao{
150
+
151
+
152
+
153
+ public List<Product> selectAll();
154
+
155
+ }
156
+
157
+ ```
158
+
159
+ ```
160
+
161
+ entity(bean?)
162
+
163
+
164
+
165
+ package product.entity;
166
+
167
+
168
+
169
+ import org.seasar.dao.annotation.tiger.Bean;
170
+
171
+
172
+
173
+ //MySQLで作ったテーブル名を書く?
174
+
175
+ @Bean(table="PRODUCT_TABLE")
176
+
177
+ public class Product {
178
+
179
+
180
+
181
+ public Integer id;
182
+
183
+ public String country;
184
+
185
+ public String productName;
186
+
187
+ public String description;
188
+
189
+ }
190
+
191
+
192
+
193
+ ```
194
+
195
+
196
+
197
+ ```
198
+
199
+ action
200
+
201
+
202
+
203
+ package product.action;
204
+
205
+
206
+
207
+ import java.util.List;
208
+
209
+
210
+
211
+ import javax.annotation.Resource;
212
+
213
+
214
+
215
+ import org.seasar.framework.container.S2Container;
216
+
217
+ import org.seasar.framework.container.SingletonS2Container;
218
+
219
+ import org.seasar.framework.container.factory.SingletonS2ContainerFactory;
220
+
221
+ import org.seasar.struts.annotation.ActionForm;
222
+
223
+
224
+
225
+ import product.dao.ProductDao;
226
+
227
+ import product.entity.Product;
228
+
229
+ import product.form.EchoForm;
230
+
231
+
232
+
233
+ public class EchoAction {
234
+
235
+ // 設定ファイルのPath
236
+
237
+ private static final String PATH = "test/src/main/resources/s2Dao.dicon";
238
+
239
+
240
+
241
+ //アクションフォーム
242
+
243
+ @Resource
244
+
245
+ @ActionForm
246
+
247
+ protected EchoForm echoForm;
248
+
249
+
250
+
251
+ /** 入力画面の実行メソッド */
252
+
253
+ @Execute(validator=false)
254
+
255
+ public String index(){
256
+
257
+ return "top.jsp";
258
+
259
+ }
260
+
261
+
262
+
263
+
264
+
265
+ // DBから値を受け取るメソッド
266
+
267
+ public String main(){
268
+
269
+
270
+
271
+ // 設定ファイルを読み込む.
272
+
273
+ SingletonS2ContainerFactory.setConfigPath(PATH);
274
+
275
+
276
+
277
+ // 初期化する.
278
+
279
+ SingletonS2ContainerFactory.init();
280
+
281
+
282
+
283
+ // コンテナを取得する.
284
+
285
+ S2Container container = SingletonS2ContainerFactory.getContainer();
286
+
287
+
288
+
289
+ ProductDao proDao = (ProductDao)SingletonS2Container.getComponent(ProductDao.class);
290
+
291
+ List<Product> list = proDao.selectAll();
292
+
293
+ //確認
294
+
295
+ for (Product pro : list) {
296
+
297
+ System.out.print(" pro.id : " + pro.id);
298
+
299
+ System.out.println(" pro.productName : " + pro.productName);
300
+
301
+ System.out.println(" pro.country : " + pro.country);
302
+
303
+ System.out.println(" pro.description : " + pro.description);
304
+
305
+ }
306
+
307
+ return "echo.jsp";
308
+
309
+ }
310
+
311
+ }
312
+
313
+ ```

1

s2Dao\.diconの作成ができてませんでした。

2017/04/21 09:05

投稿

exten
exten

スコア15

test CHANGED
File without changes
test CHANGED
@@ -87,3 +87,19 @@
87
87
 
88
88
 
89
89
  ```
90
+
91
+ 04/17追記
92
+
93
+ s2Dao.diconが自動生成されてなかった(自作しないといけない?)
94
+
95
+ のが原因のようです。
96
+
97
+ jdbc.dicon dao.dicon s2jdbc.dicon 生成されており、修正しております。
98
+
99
+
100
+
101
+ 参考URL:http://snowhiro.web.fc2.com/seasar2/Seasar2_04_S2Dao_02.html
102
+
103
+
104
+
105
+ s2Dao.diconを作成について調査中です。