質問編集履歴
2
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,508 +14,512 @@
|
|
14
14
|
|
15
15
|
登録画面で値を受け取れない
|
16
16
|
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
todouhuken_search.jsp
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
<%@ page language="java" contentType="text/html; charset=utf-8"
|
26
|
+
|
27
|
+
pageEncoding="utf-8"%>
|
28
|
+
|
29
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
30
|
+
|
31
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
32
|
+
|
33
|
+
<html>
|
34
|
+
|
35
|
+
<head>
|
36
|
+
|
37
|
+
<meta http-equiv="Content-Language" content="ja"></meta>
|
38
|
+
|
39
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
|
40
|
+
|
41
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
42
|
+
|
43
|
+
<link rel="stylesheet" type="text/css"
|
44
|
+
|
45
|
+
href="${pageContext.request.contextPath}/css/design_common.css" />
|
46
|
+
|
47
|
+
<link rel="stylesheet" type="text/css"
|
48
|
+
|
49
|
+
href="${pageContext.request.contextPath}/css/design_todouhuken_search.css" />
|
50
|
+
|
51
|
+
<script type="text/javascript">
|
52
|
+
|
53
|
+
function submitData(pAction) {
|
54
|
+
|
55
|
+
document.forms[0].action = pAction;
|
56
|
+
|
57
|
+
document.forms[0].submit();
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
</script>
|
62
|
+
|
63
|
+
<script type="text/javascript">
|
64
|
+
|
65
|
+
function submitData(pAction) {
|
66
|
+
|
67
|
+
document.forms[0].action = pAction;
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
</script>
|
72
|
+
|
73
|
+
</head>
|
74
|
+
|
75
|
+
<body>
|
76
|
+
|
77
|
+
<div
|
78
|
+
|
79
|
+
style="background-color: #00ccff; width: *px; padding: 10px; border: 1px solid #ccc">
|
80
|
+
|
81
|
+
研修システム</div>
|
82
|
+
|
83
|
+
<div
|
84
|
+
|
85
|
+
style="background-color: #ffccff; width: 240px; padding: 10px; border: 1px solid #ccc">
|
86
|
+
|
87
|
+
都道府県一覧</div>
|
88
|
+
|
89
|
+
<form method="post" action="?">
|
90
|
+
|
91
|
+
<div class="content">
|
92
|
+
|
93
|
+
<div class="searchCond">
|
94
|
+
|
95
|
+
<div class="condItem">
|
96
|
+
|
97
|
+
<div>
|
98
|
+
|
99
|
+
県名:<input type="text" name="kennmei"
|
100
|
+
|
101
|
+
value="<c:out value='${kennmei}'/>" />
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<div>
|
106
|
+
|
107
|
+
地方:<input type="text" name="chihou"
|
108
|
+
|
109
|
+
value="<c:out value='${kennmei}'/>" />
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div>
|
114
|
+
|
115
|
+
人口:<input type="text" name="jinnkouFrom"
|
116
|
+
|
117
|
+
value="<c:out value='${kennmei}'/>" /> ~<input type="text"
|
118
|
+
|
119
|
+
name="jinnkouTo" value="<c:out value='${kennmei}'/>" />
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
</div>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<div align="right" class="condButton">
|
130
|
+
|
131
|
+
<button type="submit" name="submitButtonName" value="search"
|
132
|
+
|
133
|
+
onclick="submitData('./TodouhukenSearch_Search');">検索</button>
|
134
|
+
|
135
|
+
<button type="submit" name="submitButtonName" value="add"
|
136
|
+
|
137
|
+
onclick="submitData('./TodouhukenRegistAdd');">追加</button>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<div style="height: 250px; width: 600px; overflow-y: scroll;">
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<div class="resultList">
|
152
|
+
|
153
|
+
<table class="todouhukenTable">
|
154
|
+
|
155
|
+
<table border="1">
|
156
|
+
|
157
|
+
<thead>
|
158
|
+
|
159
|
+
<tr>
|
160
|
+
|
161
|
+
<th class="kennbanngo" width="100">県番号</th>
|
162
|
+
|
163
|
+
<th class="kennmei" width="150">県名</th>
|
164
|
+
|
165
|
+
<th class="kenncyousyozaichi" width="150">県庁所在地</th>
|
166
|
+
|
167
|
+
<th class="chihou" width="150">地方</th>
|
168
|
+
|
169
|
+
<th class="jinnkou" width="150">人口</th>
|
170
|
+
|
171
|
+
<th class="syousai" width="150">詳細</th>
|
172
|
+
|
173
|
+
</tr>
|
174
|
+
|
175
|
+
</thead>
|
176
|
+
|
177
|
+
<tbody>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<c:forEach var="todouhuken" items="${todouhukenList}"
|
182
|
+
|
183
|
+
varStatus="st">
|
184
|
+
|
185
|
+
<tr>
|
186
|
+
|
187
|
+
<td class="kennbanngo">${todouhuken.kennBanngo}</td>
|
188
|
+
|
189
|
+
<td class="kennmei">${todouhuken.kennmei}</td>
|
190
|
+
|
191
|
+
<td class="kenncyousyozaichi">${todouhuken.kenncyouSyozaichi}</td>
|
192
|
+
|
193
|
+
<td class="chihou">${todouhuken.chihou}</td>
|
194
|
+
|
195
|
+
<td class="jinnkou">${todouhuken.jinnkou}</td>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<form method="post" action="?">
|
200
|
+
|
201
|
+
<td><button type="submit" name="submitButtonName"
|
202
|
+
|
203
|
+
class="kennbanngo"
|
204
|
+
|
205
|
+
onclick="submitData('./TodouhukenSearch_Details');">詳細</button>
|
206
|
+
|
17
207
|
```
|
18
208
|
|
19
209
|
|
20
210
|
|
21
|
-
|
211
|
+
```
|
22
|
-
|
23
|
-
|
24
|
-
|
212
|
+
|
25
|
-
|
213
|
+
todouhuken_regist.jsp
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<%@ page language="java" contentType="text/html; charset=utf-8"
|
218
|
+
|
219
|
+
pageEncoding="utf-8"%>
|
220
|
+
|
221
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
222
|
+
|
223
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
224
|
+
|
225
|
+
<link rel="stylesheet" type="text/css"
|
226
|
+
|
227
|
+
href="${pageContext.request.contextPath}/css/design_todouhuken_search.css" />
|
228
|
+
|
229
|
+
<html>
|
230
|
+
|
231
|
+
<script type="text/javascript">
|
232
|
+
|
233
|
+
function submitData(pAction) {
|
234
|
+
|
235
|
+
document.forms[0].action = pAction;
|
236
|
+
|
237
|
+
document.forms[0].submit();
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
</script>
|
242
|
+
|
243
|
+
<script type="text/javascript">
|
244
|
+
|
245
|
+
function submitData(pAction) {
|
246
|
+
|
247
|
+
document.forms[0].action = pAction;
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
</script>
|
252
|
+
|
253
|
+
<head>
|
254
|
+
|
255
|
+
<div
|
256
|
+
|
257
|
+
style="background-color: #00ccff; width: *px; padding: 6px; border: 1px solid #ccc">
|
258
|
+
|
259
|
+
研修システム</div>
|
260
|
+
|
261
|
+
<div
|
262
|
+
|
263
|
+
style="background-color: #ffccff; width: 240px; padding: 6px; border: 1px solid #ccc">
|
264
|
+
|
265
|
+
都道府県登録</div>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
</head>
|
270
|
+
|
271
|
+
<body>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
<form method="post" action="?">
|
282
|
+
|
283
|
+
<div>
|
284
|
+
|
285
|
+
県名:<input type="text" name="kennmei"
|
286
|
+
|
287
|
+
value="<c:out value='${kennmei}'/>" />
|
288
|
+
|
289
|
+
</div>
|
290
|
+
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<div align="right" class="condButton">
|
294
|
+
|
295
|
+
<button type="submit" name="submitButtonName" value="search"
|
296
|
+
|
297
|
+
onclick="submitData('./TodouhukenSearch_Details');">検索</button>
|
298
|
+
|
299
|
+
<form method="post" action="./MenuButtonClick">
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<c:forEach var="todouhuken" items="${todouhukenList}" varStatus="st">
|
304
|
+
|
305
|
+
</form>
|
306
|
+
|
307
|
+
</tbody>
|
308
|
+
|
309
|
+
</table>
|
310
|
+
|
311
|
+
</table>
|
312
|
+
|
313
|
+
</div>
|
314
|
+
|
315
|
+
</div>
|
316
|
+
|
317
|
+
</div>
|
318
|
+
|
319
|
+
</body>
|
320
|
+
|
321
|
+
</form>
|
322
|
+
|
323
|
+
</form>
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
<font name="kenban" size="2" color="#000000">県番号 </font>:
|
328
|
+
|
329
|
+
<input class="kennbanngo" value=${todouhuken.kennBanngo } type="text"><br />
|
330
|
+
|
331
|
+
<font size="2" color="#000000">県名 </font>:
|
332
|
+
|
333
|
+
<input class="kennmei" value=${todouhuken.kennmei } type="text">
|
334
|
+
|
335
|
+
<br />
|
336
|
+
|
337
|
+
<font size="2" color="#000000">県庁所在地</font>:
|
338
|
+
|
339
|
+
<input class="kenncyousyozaichi" type="text"
|
340
|
+
|
341
|
+
value=${todouhuken.kenncyouSyozaichi}>
|
342
|
+
|
343
|
+
<br />
|
344
|
+
|
345
|
+
<font size="2" color="#000000">地方 </font>:
|
346
|
+
|
347
|
+
<input class="chihou" value=${todouhuken.chihou } type="text">
|
348
|
+
|
349
|
+
<br />
|
350
|
+
|
351
|
+
<font size="2" color="#000000">人口 </font>:
|
352
|
+
|
353
|
+
<input class="jinnkou" value=${todouhuken.jinnkou } type="text">
|
354
|
+
|
355
|
+
<br />
|
356
|
+
|
357
|
+
</c:forEach>
|
358
|
+
|
359
|
+
</form>
|
360
|
+
|
361
|
+
```
|
362
|
+
|
363
|
+
```
|
364
|
+
|
365
|
+
TodouhukenSearch_DetailsServlet
|
366
|
+
|
367
|
+
package training.controller.todouhuken.regist;
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
import java.io.IOException;
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
import javax.servlet.RequestDispatcher;
|
378
|
+
|
379
|
+
import javax.servlet.ServletException;
|
380
|
+
|
381
|
+
import javax.servlet.annotation.WebServlet;
|
382
|
+
|
383
|
+
import javax.servlet.http.HttpServlet;
|
384
|
+
|
385
|
+
import javax.servlet.http.HttpServletRequest;
|
386
|
+
|
387
|
+
import javax.servlet.http.HttpServletResponse;
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
import training.dto.todouhuken.search.TodouhukenSearchDto;
|
392
|
+
|
393
|
+
import training.logic.todouhuken.search.TodouhukenSearchLogic;
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
/**
|
398
|
+
|
399
|
+
* 都道府県一覧画面ボタン押下時処理サーブレット
|
400
|
+
|
401
|
+
*/
|
402
|
+
|
403
|
+
@WebServlet("/TodouhukenSearch_Details")
|
404
|
+
|
405
|
+
public class TodouhukenSearch_DetailsServlet extends HttpServlet {
|
406
|
+
|
407
|
+
private static final long serialVersionUID = 1L;
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
/**
|
412
|
+
|
413
|
+
* 都道府県一覧画面ボタン押下時処理
|
414
|
+
|
415
|
+
*
|
416
|
+
|
417
|
+
* 押下されたボタンに応じてサーブレットパスを設定し、画面遷移する。
|
418
|
+
|
419
|
+
*
|
420
|
+
|
421
|
+
*/
|
422
|
+
|
423
|
+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
// 文字エンコードの設定(リクエスト)
|
428
|
+
|
429
|
+
request.setCharacterEncoding("utf-8");
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
// リクエストパラメータから値取得
|
434
|
+
|
435
|
+
String kennBanngo = request.getParameter("kennBanngo");
|
436
|
+
|
437
|
+
String kennmei = request.getParameter("kennmei");
|
438
|
+
|
439
|
+
String chihou = request.getParameter("chihou");
|
440
|
+
|
441
|
+
String kenncyouSyozaichi = request.getParameter("kenncyouSyozaichi");
|
442
|
+
|
443
|
+
String jinnkou = request.getParameter("jinnkou");
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
// 都道府県一覧画面用DTOを生成
|
450
|
+
|
451
|
+
TodouhukenSearchDto dto = new TodouhukenSearchDto();
|
452
|
+
|
453
|
+
// 画面入力した値を設定
|
454
|
+
|
455
|
+
dto.setKennmei(kennBanngo);
|
456
|
+
|
457
|
+
dto.setKennmei(kennmei);
|
458
|
+
|
459
|
+
dto.setChihou(chihou);
|
460
|
+
|
461
|
+
dto.setJinnkouFrom(kenncyouSyozaichi);
|
462
|
+
|
463
|
+
dto.setJinnkouTo(jinnkou);
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
// 一覧の情報取得
|
468
|
+
|
469
|
+
TodouhukenSearchLogic logic = new TodouhukenSearchLogic();
|
470
|
+
|
471
|
+
logic.getTodouhukenList(dto);
|
472
|
+
|
473
|
+
// 画面表示時に使用する値を設定
|
474
|
+
|
475
|
+
request.setAttribute("kennBanngo",kennBanngo);
|
476
|
+
|
477
|
+
request.setAttribute("kennmei", kennmei);
|
478
|
+
|
479
|
+
request.setAttribute("chihou", chihou);
|
480
|
+
|
481
|
+
request.setAttribute("kenncyouSyozaichi", kenncyouSyozaichi);
|
482
|
+
|
483
|
+
request.setAttribute("jinnkou", jinnkou);
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
// 取得した一覧を設定
|
488
|
+
|
489
|
+
request.setAttribute("todouhukenList", dto.getTodouhukenList());
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
// 文字エンコードの設定(レスポンス)
|
494
|
+
|
495
|
+
response.setContentType("text/html; utf-8");
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
// フォワード先をregist.jspに設定
|
500
|
+
|
501
|
+
String forwardPath = "/WEB-INF/view/todouhuken_regist.jsp";
|
502
|
+
|
503
|
+
RequestDispatcher dispatcher = request.getRequestDispatcher(forwardPath);
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
// フォワード実行
|
508
|
+
|
509
|
+
dispatcher.forward(request, response);
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
}
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
}
|
518
|
+
|
519
|
+
```
|
26
520
|
|
27
521
|
ソースコード
|
28
522
|
|
29
|
-
<%@ page language="java" contentType="text/html; charset=utf-8"
|
30
|
-
|
31
|
-
pageEncoding="utf-8"%>
|
32
|
-
|
33
|
-
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
34
|
-
|
35
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
36
|
-
|
37
|
-
<html>
|
38
|
-
|
39
|
-
<head>
|
40
|
-
|
41
|
-
<meta http-equiv="Content-Language" content="ja"></meta>
|
42
|
-
|
43
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
|
44
|
-
|
45
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
46
|
-
|
47
|
-
<link rel="stylesheet" type="text/css"
|
48
|
-
|
49
|
-
href="${pageContext.request.contextPath}/css/design_common.css" />
|
50
|
-
|
51
|
-
<link rel="stylesheet" type="text/css"
|
52
|
-
|
53
|
-
href="${pageContext.request.contextPath}/css/design_todouhuken_search.css" />
|
54
|
-
|
55
|
-
<script type="text/javascript">
|
56
|
-
|
57
|
-
function submitData(pAction) {
|
58
|
-
|
59
|
-
document.forms[0].action = pAction;
|
60
|
-
|
61
|
-
document.forms[0].submit();
|
62
|
-
|
63
|
-
}
|
64
|
-
|
65
|
-
</script>
|
66
|
-
|
67
|
-
<script type="text/javascript">
|
68
|
-
|
69
|
-
function submitData(pAction) {
|
70
|
-
|
71
|
-
document.forms[0].action = pAction;
|
72
|
-
|
73
|
-
}
|
74
|
-
|
75
|
-
</script>
|
76
|
-
|
77
|
-
</head>
|
78
|
-
|
79
|
-
<body>
|
80
|
-
|
81
|
-
<div
|
82
|
-
|
83
|
-
style="background-color: #00ccff; width: *px; padding: 10px; border: 1px solid #ccc">
|
84
|
-
|
85
|
-
研修システム</div>
|
86
|
-
|
87
|
-
<div
|
88
|
-
|
89
|
-
style="background-color: #ffccff; width: 240px; padding: 10px; border: 1px solid #ccc">
|
90
|
-
|
91
|
-
都道府県一覧</div>
|
92
|
-
|
93
|
-
<form method="post" action="?">
|
94
|
-
|
95
|
-
<div class="content">
|
96
|
-
|
97
|
-
<div class="searchCond">
|
98
|
-
|
99
|
-
<div class="condItem">
|
100
|
-
|
101
|
-
<div>
|
102
|
-
|
103
|
-
県名:<input type="text" name="kennmei"
|
104
|
-
|
105
|
-
value="<c:out value='${kennmei}'/>" />
|
106
|
-
|
107
|
-
</div>
|
108
|
-
|
109
|
-
<div>
|
110
|
-
|
111
|
-
地方:<input type="text" name="chihou"
|
112
|
-
|
113
|
-
value="<c:out value='${kennmei}'/>" />
|
114
|
-
|
115
|
-
</div>
|
116
|
-
|
117
|
-
<div>
|
118
|
-
|
119
|
-
人口:<input type="text" name="jinnkouFrom"
|
120
|
-
|
121
|
-
value="<c:out value='${kennmei}'/>" /> ~<input type="text"
|
122
|
-
|
123
|
-
name="jinnkouTo" value="<c:out value='${kennmei}'/>" />
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
</div>
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<div align="right" class="condButton">
|
134
|
-
|
135
|
-
<button type="submit" name="submitButtonName" value="search"
|
136
|
-
|
137
|
-
onclick="submitData('./TodouhukenSearch_Search');">検索</button>
|
138
|
-
|
139
|
-
<button type="submit" name="submitButtonName" value="add"
|
140
|
-
|
141
|
-
onclick="submitData('./TodouhukenRegistAdd');">追加</button>
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
</div>
|
146
|
-
|
147
|
-
</div>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
<div style="height: 250px; width: 600px; overflow-y: scroll;">
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
<div class="resultList">
|
156
|
-
|
157
|
-
<table class="todouhukenTable">
|
158
|
-
|
159
|
-
<table border="1">
|
160
|
-
|
161
|
-
<thead>
|
162
|
-
|
163
|
-
<tr>
|
164
|
-
|
165
|
-
<th class="kennbanngo" width="100">県番号</th>
|
166
|
-
|
167
|
-
<th class="kennmei" width="150">県名</th>
|
168
|
-
|
169
|
-
<th class="kenncyousyozaichi" width="150">県庁所在地</th>
|
170
|
-
|
171
|
-
<th class="chihou" width="150">地方</th>
|
172
|
-
|
173
|
-
<th class="jinnkou" width="150">人口</th>
|
174
|
-
|
175
|
-
<th class="syousai" width="150">詳細</th>
|
176
|
-
|
177
|
-
</tr>
|
178
|
-
|
179
|
-
</thead>
|
180
|
-
|
181
|
-
<tbody>
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
<c:forEach var="todouhuken" items="${todouhukenList}"
|
186
|
-
|
187
|
-
varStatus="st">
|
188
|
-
|
189
|
-
<tr>
|
190
|
-
|
191
|
-
<td class="kennbanngo">${todouhuken.kennBanngo}</td>
|
192
|
-
|
193
|
-
<td class="kennmei">${todouhuken.kennmei}</td>
|
194
|
-
|
195
|
-
<td class="kenncyousyozaichi">${todouhuken.kenncyouSyozaichi}</td>
|
196
|
-
|
197
|
-
<td class="chihou">${todouhuken.chihou}</td>
|
198
|
-
|
199
|
-
<td class="jinnkou">${todouhuken.jinnkou}</td>
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
<form method="post" action="?">
|
204
|
-
|
205
|
-
<td><button type="submit" name="submitButtonName"
|
206
|
-
|
207
|
-
class="kennbanngo"
|
208
|
-
|
209
|
-
onclick="submitData('./TodouhukenSearch_Details');">詳細</button>
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
```todouhuken_regist.jsp
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
<%@ page language="java" contentType="text/html; charset=utf-8"
|
218
|
-
|
219
|
-
pageEncoding="utf-8"%>
|
220
|
-
|
221
|
-
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
222
|
-
|
223
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
224
|
-
|
225
|
-
<link rel="stylesheet" type="text/css"
|
226
|
-
|
227
|
-
href="${pageContext.request.contextPath}/css/design_todouhuken_search.css" />
|
228
|
-
|
229
|
-
<html>
|
230
|
-
|
231
|
-
<script type="text/javascript">
|
232
|
-
|
233
|
-
function submitData(pAction) {
|
234
|
-
|
235
|
-
document.forms[0].action = pAction;
|
236
|
-
|
237
|
-
document.forms[0].submit();
|
238
|
-
|
239
|
-
}
|
240
|
-
|
241
|
-
</script>
|
242
|
-
|
243
|
-
<script type="text/javascript">
|
244
|
-
|
245
|
-
function submitData(pAction) {
|
246
|
-
|
247
|
-
document.forms[0].action = pAction;
|
248
|
-
|
249
|
-
}
|
250
|
-
|
251
|
-
</script>
|
252
|
-
|
253
|
-
<head>
|
254
|
-
|
255
|
-
<div
|
256
|
-
|
257
|
-
style="background-color: #00ccff; width: *px; padding: 6px; border: 1px solid #ccc">
|
258
|
-
|
259
|
-
研修システム</div>
|
260
|
-
|
261
|
-
<div
|
262
|
-
|
263
|
-
style="background-color: #ffccff; width: 240px; padding: 6px; border: 1px solid #ccc">
|
264
|
-
|
265
|
-
都道府県登録</div>
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
</head>
|
270
|
-
|
271
|
-
<body>
|
272
|
-
|
273
|
-
</div>
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
<form method="post" action="?">
|
282
|
-
|
283
|
-
<div>
|
284
|
-
|
285
|
-
県名:<input type="text" name="kennmei"
|
286
|
-
|
287
|
-
value="<c:out value='${kennmei}'/>" />
|
288
|
-
|
289
|
-
</div>
|
290
|
-
|
291
|
-
</div>
|
292
|
-
|
293
|
-
<div align="right" class="condButton">
|
294
|
-
|
295
|
-
<button type="submit" name="submitButtonName" value="search"
|
296
|
-
|
297
|
-
onclick="submitData('./TodouhukenSearch_Details');">検索</button>
|
298
|
-
|
299
|
-
<form method="post" action="./MenuButtonClick">
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
<c:forEach var="todouhuken" items="${todouhukenList}" varStatus="st">
|
304
|
-
|
305
|
-
</form>
|
306
|
-
|
307
|
-
</tbody>
|
308
|
-
|
309
|
-
</table>
|
310
|
-
|
311
|
-
</table>
|
312
|
-
|
313
|
-
</div>
|
314
|
-
|
315
|
-
</div>
|
316
|
-
|
317
|
-
</div>
|
318
|
-
|
319
|
-
</body>
|
320
|
-
|
321
|
-
</form>
|
322
|
-
|
323
|
-
</form>
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
<font name="kenban" size="2" color="#000000">県番号 </font>:
|
328
|
-
|
329
|
-
<input class="kennbanngo" value=${todouhuken.kennBanngo } type="text"><br />
|
330
|
-
|
331
|
-
<font size="2" color="#000000">県名 </font>:
|
332
|
-
|
333
|
-
<input class="kennmei" value=${todouhuken.kennmei } type="text">
|
334
|
-
|
335
|
-
<br />
|
336
|
-
|
337
|
-
<font size="2" color="#000000">県庁所在地</font>:
|
338
|
-
|
339
|
-
<input class="kenncyousyozaichi" type="text"
|
340
|
-
|
341
|
-
value=${todouhuken.kenncyouSyozaichi}>
|
342
|
-
|
343
|
-
<br />
|
344
|
-
|
345
|
-
<font size="2" color="#000000">地方 </font>:
|
346
|
-
|
347
|
-
<input class="chihou" value=${todouhuken.chihou } type="text">
|
348
|
-
|
349
|
-
<br />
|
350
|
-
|
351
|
-
<font size="2" color="#000000">人口 </font>:
|
352
|
-
|
353
|
-
<input class="jinnkou" value=${todouhuken.jinnkou } type="text">
|
354
|
-
|
355
|
-
<br />
|
356
|
-
|
357
|
-
</c:forEach>
|
358
|
-
|
359
|
-
</form>
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
```TodouhukenSearch_DetailsServlet
|
364
|
-
|
365
|
-
package training.controller.todouhuken.regist;
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
import java.io.IOException;
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
import javax.servlet.RequestDispatcher;
|
376
|
-
|
377
|
-
import javax.servlet.ServletException;
|
378
|
-
|
379
|
-
import javax.servlet.annotation.WebServlet;
|
380
|
-
|
381
|
-
import javax.servlet.http.HttpServlet;
|
382
|
-
|
383
|
-
import javax.servlet.http.HttpServletRequest;
|
384
|
-
|
385
|
-
import javax.servlet.http.HttpServletResponse;
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
import training.dto.todouhuken.search.TodouhukenSearchDto;
|
390
|
-
|
391
|
-
import training.logic.todouhuken.search.TodouhukenSearchLogic;
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
/**
|
396
|
-
|
397
|
-
* 都道府県一覧画面ボタン押下時処理サーブレット
|
398
|
-
|
399
|
-
*/
|
400
|
-
|
401
|
-
@WebServlet("/TodouhukenSearch_Details")
|
402
|
-
|
403
|
-
public class TodouhukenSearch_DetailsServlet extends HttpServlet {
|
404
|
-
|
405
|
-
private static final long serialVersionUID = 1L;
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
/**
|
410
|
-
|
411
|
-
* 都道府県一覧画面ボタン押下時処理
|
412
|
-
|
413
|
-
*
|
414
|
-
|
415
|
-
* 押下されたボタンに応じてサーブレットパスを設定し、画面遷移する。
|
416
|
-
|
417
|
-
*
|
418
|
-
|
419
|
-
*/
|
420
|
-
|
421
|
-
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
// 文字エンコードの設定(リクエスト)
|
426
|
-
|
427
|
-
request.setCharacterEncoding("utf-8");
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
// リクエストパラメータから値取得
|
432
|
-
|
433
|
-
String kennBanngo = request.getParameter("kennBanngo");
|
434
|
-
|
435
|
-
String kennmei = request.getParameter("kennmei");
|
436
|
-
|
437
|
-
String chihou = request.getParameter("chihou");
|
438
|
-
|
439
|
-
String kenncyouSyozaichi = request.getParameter("kenncyouSyozaichi");
|
440
|
-
|
441
|
-
String jinnkou = request.getParameter("jinnkou");
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
// 都道府県一覧画面用DTOを生成
|
448
|
-
|
449
|
-
TodouhukenSearchDto dto = new TodouhukenSearchDto();
|
450
|
-
|
451
|
-
// 画面入力した値を設定
|
452
|
-
|
453
|
-
dto.setKennmei(kennBanngo);
|
454
|
-
|
455
|
-
dto.setKennmei(kennmei);
|
456
|
-
|
457
|
-
dto.setChihou(chihou);
|
458
|
-
|
459
|
-
dto.setJinnkouFrom(kenncyouSyozaichi);
|
460
|
-
|
461
|
-
dto.setJinnkouTo(jinnkou);
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
// 一覧の情報取得
|
466
|
-
|
467
|
-
TodouhukenSearchLogic logic = new TodouhukenSearchLogic();
|
468
|
-
|
469
|
-
logic.getTodouhukenList(dto);
|
470
|
-
|
471
|
-
// 画面表示時に使用する値を設定
|
472
|
-
|
473
|
-
request.setAttribute("kennBanngo",kennBanngo);
|
474
|
-
|
475
|
-
request.setAttribute("kennmei", kennmei);
|
476
|
-
|
477
|
-
request.setAttribute("chihou", chihou);
|
478
|
-
|
479
|
-
request.setAttribute("kenncyouSyozaichi", kenncyouSyozaichi);
|
480
|
-
|
481
|
-
request.setAttribute("jinnkou", jinnkou);
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
// 取得した一覧を設定
|
486
|
-
|
487
|
-
request.setAttribute("todouhukenList", dto.getTodouhukenList());
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
// 文字エンコードの設定(レスポンス)
|
492
|
-
|
493
|
-
response.setContentType("text/html; utf-8");
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
// フォワード先をregist.jspに設定
|
498
|
-
|
499
|
-
String forwardPath = "/WEB-INF/view/todouhuken_regist.jsp";
|
500
|
-
|
501
|
-
RequestDispatcher dispatcher = request.getRequestDispatcher(forwardPath);
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
// フォワード実行
|
506
|
-
|
507
|
-
dispatcher.forward(request, response);
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
}
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
}
|
516
|
-
|
517
|
-
ソースコード
|
518
|
-
|
519
523
|
|
520
524
|
|
521
525
|
### 試したこと
|
1
コードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,31 +22,497 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
-
```
|
25
|
+
```todouhuken_search.jsp
|
26
26
|
|
27
27
|
ソースコード
|
28
28
|
|
29
|
+
<%@ page language="java" contentType="text/html; charset=utf-8"
|
30
|
+
|
31
|
+
pageEncoding="utf-8"%>
|
32
|
+
|
33
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
34
|
+
|
35
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
36
|
+
|
37
|
+
<html>
|
38
|
+
|
39
|
+
<head>
|
40
|
+
|
41
|
+
<meta http-equiv="Content-Language" content="ja"></meta>
|
42
|
+
|
43
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
|
44
|
+
|
45
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
46
|
+
|
47
|
+
<link rel="stylesheet" type="text/css"
|
48
|
+
|
49
|
+
href="${pageContext.request.contextPath}/css/design_common.css" />
|
50
|
+
|
51
|
+
<link rel="stylesheet" type="text/css"
|
52
|
+
|
53
|
+
href="${pageContext.request.contextPath}/css/design_todouhuken_search.css" />
|
54
|
+
|
55
|
+
<script type="text/javascript">
|
56
|
+
|
57
|
+
function submitData(pAction) {
|
58
|
+
|
59
|
+
document.forms[0].action = pAction;
|
60
|
+
|
61
|
+
document.forms[0].submit();
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
</script>
|
66
|
+
|
67
|
+
<script type="text/javascript">
|
68
|
+
|
69
|
+
function submitData(pAction) {
|
70
|
+
|
71
|
+
document.forms[0].action = pAction;
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
</script>
|
76
|
+
|
77
|
+
</head>
|
78
|
+
|
79
|
+
<body>
|
80
|
+
|
81
|
+
<div
|
82
|
+
|
83
|
+
style="background-color: #00ccff; width: *px; padding: 10px; border: 1px solid #ccc">
|
84
|
+
|
85
|
+
研修システム</div>
|
86
|
+
|
87
|
+
<div
|
88
|
+
|
89
|
+
style="background-color: #ffccff; width: 240px; padding: 10px; border: 1px solid #ccc">
|
90
|
+
|
91
|
+
都道府県一覧</div>
|
92
|
+
|
93
|
+
<form method="post" action="?">
|
94
|
+
|
95
|
+
<div class="content">
|
96
|
+
|
97
|
+
<div class="searchCond">
|
98
|
+
|
99
|
+
<div class="condItem">
|
100
|
+
|
101
|
+
<div>
|
102
|
+
|
103
|
+
県名:<input type="text" name="kennmei"
|
104
|
+
|
105
|
+
value="<c:out value='${kennmei}'/>" />
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div>
|
110
|
+
|
111
|
+
地方:<input type="text" name="chihou"
|
112
|
+
|
113
|
+
value="<c:out value='${kennmei}'/>" />
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div>
|
118
|
+
|
119
|
+
人口:<input type="text" name="jinnkouFrom"
|
120
|
+
|
121
|
+
value="<c:out value='${kennmei}'/>" /> ~<input type="text"
|
122
|
+
|
123
|
+
name="jinnkouTo" value="<c:out value='${kennmei}'/>" />
|
124
|
+
|
125
|
+
</div>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<div align="right" class="condButton">
|
134
|
+
|
135
|
+
<button type="submit" name="submitButtonName" value="search"
|
136
|
+
|
137
|
+
onclick="submitData('./TodouhukenSearch_Search');">検索</button>
|
138
|
+
|
139
|
+
<button type="submit" name="submitButtonName" value="add"
|
140
|
+
|
141
|
+
onclick="submitData('./TodouhukenRegistAdd');">追加</button>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<div style="height: 250px; width: 600px; overflow-y: scroll;">
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<div class="resultList">
|
156
|
+
|
157
|
+
<table class="todouhukenTable">
|
158
|
+
|
159
|
+
<table border="1">
|
160
|
+
|
161
|
+
<thead>
|
162
|
+
|
163
|
+
<tr>
|
164
|
+
|
165
|
+
<th class="kennbanngo" width="100">県番号</th>
|
166
|
+
|
167
|
+
<th class="kennmei" width="150">県名</th>
|
168
|
+
|
169
|
+
<th class="kenncyousyozaichi" width="150">県庁所在地</th>
|
170
|
+
|
171
|
+
<th class="chihou" width="150">地方</th>
|
172
|
+
|
173
|
+
<th class="jinnkou" width="150">人口</th>
|
174
|
+
|
175
|
+
<th class="syousai" width="150">詳細</th>
|
176
|
+
|
177
|
+
</tr>
|
178
|
+
|
179
|
+
</thead>
|
180
|
+
|
181
|
+
<tbody>
|
182
|
+
|
183
|
+
|
184
|
+
|
29
|
-
<c:forEach var="todouhuken" items="${todouhukenList}"
|
185
|
+
<c:forEach var="todouhuken" items="${todouhukenList}"
|
186
|
+
|
187
|
+
varStatus="st">
|
30
188
|
|
31
189
|
<tr>
|
32
190
|
|
33
191
|
<td class="kennbanngo">${todouhuken.kennBanngo}</td>
|
34
192
|
|
193
|
+
<td class="kennmei">${todouhuken.kennmei}</td>
|
194
|
+
|
195
|
+
<td class="kenncyousyozaichi">${todouhuken.kenncyouSyozaichi}</td>
|
196
|
+
|
197
|
+
<td class="chihou">${todouhuken.chihou}</td>
|
198
|
+
|
199
|
+
<td class="jinnkou">${todouhuken.jinnkou}</td>
|
200
|
+
|
201
|
+
|
202
|
+
|
35
|
-
<form method="post" action="?">
|
203
|
+
<form method="post" action="?">
|
36
|
-
|
204
|
+
|
37
|
-
<td><button type="submit" name="
|
205
|
+
<td><button type="submit" name="submitButtonName"
|
206
|
+
|
38
|
-
|
207
|
+
class="kennbanngo"
|
208
|
+
|
39
|
-
onclick="submitData('./TodouhukenSearch_Details');">詳細</button>
|
209
|
+
onclick="submitData('./TodouhukenSearch_Details');">詳細</button>
|
210
|
+
|
211
|
+
|
212
|
+
|
40
|
-
|
213
|
+
```todouhuken_regist.jsp
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<%@ page language="java" contentType="text/html; charset=utf-8"
|
218
|
+
|
219
|
+
pageEncoding="utf-8"%>
|
220
|
+
|
221
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
222
|
+
|
223
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
224
|
+
|
225
|
+
<link rel="stylesheet" type="text/css"
|
226
|
+
|
227
|
+
href="${pageContext.request.contextPath}/css/design_todouhuken_search.css" />
|
228
|
+
|
229
|
+
<html>
|
230
|
+
|
231
|
+
<script type="text/javascript">
|
232
|
+
|
233
|
+
function submitData(pAction) {
|
234
|
+
|
235
|
+
document.forms[0].action = pAction;
|
236
|
+
|
237
|
+
document.forms[0].submit();
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
</script>
|
242
|
+
|
243
|
+
<script type="text/javascript">
|
244
|
+
|
245
|
+
function submitData(pAction) {
|
246
|
+
|
247
|
+
document.forms[0].action = pAction;
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
</script>
|
252
|
+
|
253
|
+
<head>
|
254
|
+
|
255
|
+
<div
|
256
|
+
|
257
|
+
style="background-color: #00ccff; width: *px; padding: 6px; border: 1px solid #ccc">
|
258
|
+
|
259
|
+
研修システム</div>
|
260
|
+
|
261
|
+
<div
|
262
|
+
|
263
|
+
style="background-color: #ffccff; width: 240px; padding: 6px; border: 1px solid #ccc">
|
264
|
+
|
265
|
+
都道府県登録</div>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
</head>
|
270
|
+
|
271
|
+
<body>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
<form method="post" action="?">
|
282
|
+
|
283
|
+
<div>
|
284
|
+
|
285
|
+
県名:<input type="text" name="kennmei"
|
286
|
+
|
287
|
+
value="<c:out value='${kennmei}'/>" />
|
288
|
+
|
289
|
+
</div>
|
290
|
+
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<div align="right" class="condButton">
|
294
|
+
|
295
|
+
<button type="submit" name="submitButtonName" value="search"
|
296
|
+
|
297
|
+
onclick="submitData('./TodouhukenSearch_Details');">検索</button>
|
298
|
+
|
299
|
+
<form method="post" action="./MenuButtonClick">
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<c:forEach var="todouhuken" items="${todouhukenList}" varStatus="st">
|
304
|
+
|
41
|
-
</
|
305
|
+
</form>
|
306
|
+
|
307
|
+
</tbody>
|
308
|
+
|
309
|
+
</table>
|
310
|
+
|
311
|
+
</table>
|
312
|
+
|
313
|
+
</div>
|
314
|
+
|
315
|
+
</div>
|
316
|
+
|
317
|
+
</div>
|
42
318
|
|
43
319
|
</body>
|
44
320
|
|
45
|
-
</
|
321
|
+
</form>
|
46
|
-
|
322
|
+
|
47
|
-
|
323
|
+
</form>
|
48
|
-
|
324
|
+
|
325
|
+
|
326
|
+
|
49
|
-
<font name="kenban" size="2" color="#000000">県番号</font>:
|
327
|
+
<font name="kenban" size="2" color="#000000">県番号 </font>:
|
328
|
+
|
329
|
+
<input class="kennbanngo" value=${todouhuken.kennBanngo } type="text"><br />
|
330
|
+
|
331
|
+
<font size="2" color="#000000">県名 </font>:
|
332
|
+
|
333
|
+
<input class="kennmei" value=${todouhuken.kennmei } type="text">
|
334
|
+
|
335
|
+
<br />
|
336
|
+
|
337
|
+
<font size="2" color="#000000">県庁所在地</font>:
|
338
|
+
|
339
|
+
<input class="kenncyousyozaichi" type="text"
|
340
|
+
|
341
|
+
value=${todouhuken.kenncyouSyozaichi}>
|
342
|
+
|
343
|
+
<br />
|
344
|
+
|
345
|
+
<font size="2" color="#000000">地方 </font>:
|
346
|
+
|
347
|
+
<input class="chihou" value=${todouhuken.chihou } type="text">
|
348
|
+
|
349
|
+
<br />
|
350
|
+
|
351
|
+
<font size="2" color="#000000">人口 </font>:
|
352
|
+
|
353
|
+
<input class="jinnkou" value=${todouhuken.jinnkou } type="text">
|
354
|
+
|
355
|
+
<br />
|
356
|
+
|
357
|
+
</c:forEach>
|
358
|
+
|
359
|
+
</form>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
```TodouhukenSearch_DetailsServlet
|
364
|
+
|
365
|
+
package training.controller.todouhuken.regist;
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
import java.io.IOException;
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
import javax.servlet.RequestDispatcher;
|
376
|
+
|
377
|
+
import javax.servlet.ServletException;
|
378
|
+
|
379
|
+
import javax.servlet.annotation.WebServlet;
|
380
|
+
|
381
|
+
import javax.servlet.http.HttpServlet;
|
382
|
+
|
383
|
+
import javax.servlet.http.HttpServletRequest;
|
384
|
+
|
385
|
+
import javax.servlet.http.HttpServletResponse;
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
import training.dto.todouhuken.search.TodouhukenSearchDto;
|
390
|
+
|
391
|
+
import training.logic.todouhuken.search.TodouhukenSearchLogic;
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
/**
|
396
|
+
|
397
|
+
* 都道府県一覧画面ボタン押下時処理サーブレット
|
398
|
+
|
399
|
+
*/
|
400
|
+
|
401
|
+
@WebServlet("/TodouhukenSearch_Details")
|
402
|
+
|
403
|
+
public class TodouhukenSearch_DetailsServlet extends HttpServlet {
|
404
|
+
|
405
|
+
private static final long serialVersionUID = 1L;
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
/**
|
410
|
+
|
411
|
+
* 都道府県一覧画面ボタン押下時処理
|
412
|
+
|
413
|
+
*
|
414
|
+
|
415
|
+
* 押下されたボタンに応じてサーブレットパスを設定し、画面遷移する。
|
416
|
+
|
417
|
+
*
|
418
|
+
|
419
|
+
*/
|
420
|
+
|
421
|
+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
// 文字エンコードの設定(リクエスト)
|
426
|
+
|
427
|
+
request.setCharacterEncoding("utf-8");
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
// リクエストパラメータから値取得
|
432
|
+
|
433
|
+
String kennBanngo = request.getParameter("kennBanngo");
|
434
|
+
|
435
|
+
String kennmei = request.getParameter("kennmei");
|
436
|
+
|
437
|
+
String chihou = request.getParameter("chihou");
|
438
|
+
|
439
|
+
String kenncyouSyozaichi = request.getParameter("kenncyouSyozaichi");
|
440
|
+
|
441
|
+
String jinnkou = request.getParameter("jinnkou");
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
// 都道府県一覧画面用DTOを生成
|
448
|
+
|
449
|
+
TodouhukenSearchDto dto = new TodouhukenSearchDto();
|
450
|
+
|
451
|
+
// 画面入力した値を設定
|
452
|
+
|
453
|
+
dto.setKennmei(kennBanngo);
|
454
|
+
|
455
|
+
dto.setKennmei(kennmei);
|
456
|
+
|
457
|
+
dto.setChihou(chihou);
|
458
|
+
|
459
|
+
dto.setJinnkouFrom(kenncyouSyozaichi);
|
460
|
+
|
461
|
+
dto.setJinnkouTo(jinnkou);
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
// 一覧の情報取得
|
466
|
+
|
467
|
+
TodouhukenSearchLogic logic = new TodouhukenSearchLogic();
|
468
|
+
|
469
|
+
logic.getTodouhukenList(dto);
|
470
|
+
|
471
|
+
// 画面表示時に使用する値を設定
|
472
|
+
|
473
|
+
request.setAttribute("kennBanngo",kennBanngo);
|
474
|
+
|
475
|
+
request.setAttribute("kennmei", kennmei);
|
476
|
+
|
477
|
+
request.setAttribute("chihou", chihou);
|
478
|
+
|
479
|
+
request.setAttribute("kenncyouSyozaichi", kenncyouSyozaichi);
|
480
|
+
|
481
|
+
request.setAttribute("jinnkou", jinnkou);
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
// 取得した一覧を設定
|
486
|
+
|
487
|
+
request.setAttribute("todouhukenList", dto.getTodouhukenList());
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
// 文字エンコードの設定(レスポンス)
|
492
|
+
|
493
|
+
response.setContentType("text/html; utf-8");
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
// フォワード先をregist.jspに設定
|
498
|
+
|
499
|
+
String forwardPath = "/WEB-INF/view/todouhuken_regist.jsp";
|
500
|
+
|
501
|
+
RequestDispatcher dispatcher = request.getRequestDispatcher(forwardPath);
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
// フォワード実行
|
506
|
+
|
507
|
+
dispatcher.forward(request, response);
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
}
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
}
|
50
516
|
|
51
517
|
ソースコード
|
52
518
|
|