質問編集履歴

2

コードの追記

2020/06/24 05:04

投稿

aaaajj
aaaajj

スコア5

test CHANGED
File without changes
test CHANGED
@@ -48,131 +48,409 @@
48
48
 
49
49
  <html>
50
50
 
51
+ <body>
52
+
53
+
54
+
55
+
56
+
57
+ <form method="POST" action="'./TodouhukenSearch_Details'">
58
+
59
+
60
+
61
+ <div>
62
+
63
+ 県番号 :<input type="text" name="kennBanngo"disabled="disabled"
64
+
65
+ value="<c:out value='${kennBanngo}'/>" /><br />
66
+
67
+ </div>
68
+
69
+ <div>
70
+
71
+ 県名:<input type="text" name="kennmei"
72
+
73
+ value="<c:out value='${kennmei}'/>" /> <br>
74
+
75
+ </div>
76
+
77
+ <div>
78
+
79
+ 県庁所在地:<input type="text" name="kenncyouSyozaichi"
80
+
81
+ value="<c:out value='${kenncyouSyozaichi}'/>" />
82
+
83
+ </div>
84
+
85
+ <div>
86
+
87
+ 地方 :<input type="text" name="chihou"
88
+
89
+ value="<c:out value='${chihou}'/>" /><br />
90
+
91
+ <div>
92
+
93
+ 人口 :<input type="text" name="jinnkou"
94
+
95
+ value="<c:out value='${jinnkou}'/>" /><br />
96
+
97
+ </form>
98
+
99
+ <form action="#" method="post">
100
+
101
+ <table>
102
+
103
+ <tr>
104
+
105
+ <td>
106
+
107
+ <button class="btn" type="button" onclick="history.back()"
108
+
109
+ style="position: absolute; left: px; bottom: 50px">一覧に戻る</button>
110
+
111
+ </td>
112
+
113
+ </div>
114
+
115
+ <td><input type="submit" name="register" value="登録"
116
+
117
+ style="position: absolute; left: 100px; bottom: 50px"></td>
118
+
119
+ </tr>
120
+
121
+
122
+
123
+ <c:if test="${kennBanngo >= 0}">
124
+
125
+ <input type="submit" name="register" value="更新"
126
+
127
+ style="position: absolute; left: 100px; bottom: 50px">
128
+
129
+ <input type="submit" name="register" value="削除"
130
+
131
+ style="position: absolute; left: 150px; bottom: 50px">
132
+
133
+ </c:if>
134
+
135
+ </table>
136
+
137
+ </div>
138
+
139
+ </div>
140
+
141
+ <footer>
142
+
143
+ <div
144
+
145
+ style="position: absolute; text-align: center; bottom: 0; width: 99%; height: 30px; background-color: #00ccff">
146
+
147
+ Copyright (c) training. All Rights Reserved.</div>
148
+
149
+ </footer>
150
+
151
+ </body>
152
+
153
+ </html>
154
+
155
+ ```
156
+
157
+ TodouhukenSearch_DetailsServlet
158
+
159
+ ```
160
+
161
+ package training.controller.todouhuken.regist;
162
+
163
+
164
+
165
+ import java.io.IOException;
166
+
167
+
168
+
169
+ import javax.servlet.RequestDispatcher;
170
+
171
+ import javax.servlet.ServletException;
172
+
173
+ import javax.servlet.annotation.WebServlet;
174
+
175
+ import javax.servlet.http.HttpServlet;
176
+
177
+ import javax.servlet.http.HttpServletRequest;
178
+
179
+ import javax.servlet.http.HttpServletResponse;
180
+
181
+
182
+
183
+ import training.dto.todouhuken.regist.TodouhukenRegistDto;
184
+
185
+ import training.logic.todouhuken.regist.TodouhukenRegistLogic;
186
+
187
+
188
+
189
+ @WebServlet("/TodouhukenSearch_Details")
190
+
191
+ public class TodouhukenSearch_DetailsServlet extends HttpServlet {
192
+
193
+ private static final long serialVersionUID = 1L;
194
+
195
+
196
+
197
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
198
+
199
+ throws ServletException, IOException {
200
+
201
+
202
+
203
+ request.setCharacterEncoding("utf-8");
204
+
205
+
206
+
207
+ String kennBanngo = request.getParameter("kennBanngo");
208
+
209
+
210
+
211
+ TodouhukenRegistDto dto = new TodouhukenRegistDto();
212
+
213
+
214
+
215
+ dto.setkennBanngo(kennBanngo);
216
+
217
+
218
+
219
+ TodouhukenRegistLogic logic = new TodouhukenRegistLogic();
220
+
221
+ logic.getTodouhukenList(dto);
222
+
223
+
224
+
225
+ request.setAttribute("kennBanngo", dto.getSelectTodouhukenDetail().getKennBanngo());
226
+
227
+ request.setAttribute("kennmei", dto.getSelectTodouhukenDetail().getKennmei());
228
+
229
+ request.setAttribute("kenncyouSyozaichi", dto.getSelectTodouhukenDetail().getKenncyouSyozaichi());
230
+
231
+ request.setAttribute("chihou", dto.getSelectTodouhukenDetail().getChihou());
232
+
233
+ request.setAttribute("jinnkou", dto.getSelectTodouhukenDetail().getJinnkou());
234
+
235
+
236
+
237
+ request.setAttribute("selectTodouhukenDetail", dto.getSelectTodouhukenDetail());
238
+
239
+
240
+
241
+ response.setContentType("text/html; utf-8");
242
+
243
+
244
+
245
+ String forwardPath = "/WEB-INF/view/todouhuken_regist.jsp";
246
+
247
+ RequestDispatcher dispatcher = request.getRequestDispatcher(forwardPath);
248
+
249
+
250
+
251
+ dispatcher.forward(request, response);
252
+
253
+
254
+
255
+ }
256
+
257
+
258
+
259
+ }
260
+
261
+ ```
262
+
263
+ todouhuken_search.jsp
264
+
265
+ ```
266
+
267
+ <%@ page language="java" contentType="text/html; charset=utf-8"
268
+
269
+ pageEncoding="utf-8"%>
270
+
271
+ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
272
+
273
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
274
+
275
+ <html>
276
+
51
277
  <head>
52
278
 
279
+ <meta http-equiv="Content-Language" content="ja"></meta>
280
+
281
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
282
+
283
+ <meta name="viewport" content="width=device-width,initial-scale=1">
284
+
285
+ <link rel="stylesheet" type="text/css"
286
+
287
+ href="${pageContext.request.contextPath}/css/design_common.css" />
288
+
289
+ <link rel="stylesheet" type="text/css"
290
+
291
+ href="${pageContext.request.contextPath}/css/design_todouhuken_search.css" />
292
+
293
+ <script type="text/javascript">
294
+
295
+ function submitData(pAction) {
296
+
297
+ document.forms[0].action = pAction;
298
+
299
+ document.forms[0].submit();
300
+
301
+ }
302
+
303
+ </script>
304
+
305
+ </head>
306
+
307
+ <body>
308
+
309
+ <form method="post" action="?">
310
+
311
+ <div class="content">
312
+
313
+ <div class="searchCond">
314
+
315
+
316
+
317
+ <div class="condItem">
318
+
319
+ <div>
320
+
321
+ 県名:<input type="text" name="kennmei"
322
+
323
+ value="<c:out value='${kennmei}'/>" />
324
+
325
+ </div>
326
+
327
+ <div>
328
+
329
+ 地方:<input type="text" name="chihou"
330
+
331
+ value="<c:out value='${chihou}'/>" />
332
+
333
+ </div>
334
+
335
+ <div>
336
+
337
+ 人口:<input type="text" name="jinnkouFrom"
338
+
339
+ value="<c:out value='${jinnkouFrom}'/>" /> ~<input type="text"
340
+
341
+ name="jinnkouTo" value="<c:out value='${jinnkouTo}'/>" />
342
+
343
+ </div>
344
+
345
+ </div>
346
+
347
+ </div>
348
+
349
+
350
+
351
+ <div align="right" class="condButton">
352
+
353
+ <button type="submit" name="submitButtonName" value="search"
354
+
355
+ onclick="submitData('./TodouhukenSearch_Search');">検索</button>
356
+
357
+ <button type="submit" name="submitButtonName" value="add"
358
+
359
+ onclick="submitData('./TodouhukenSearch_Add');">追加</button>
360
+
361
+ </div>
362
+
363
+ </div>
364
+
365
+ <div style="height: 250px; width: 600px; overflow-y: scroll;">
366
+
367
+ <div class="resultList">
368
+
369
+ <table class="todouhukenTable" border="1">
370
+
371
+ <thead>
372
+
373
+ <tr>
374
+
375
+ <th class="kennbanngo" width="100">県番号</th>
376
+
377
+ <th class="kennmei" width="150">県名</th>
378
+
379
+ <th class="kenncyousyozaichi" width="150">県庁所在地</th>
380
+
381
+ <th class="chihou" width="150">地方</th>
382
+
383
+ <th class="jinnkou" width="150">人口</th>
384
+
385
+ <th class="syousai" width="150">詳細</th>
386
+
387
+ </tr>
388
+
389
+ </thead>
390
+
391
+ <tbody>
392
+
393
+ <form method="post" action="?">
394
+
395
+ <c:forEach var="todouhuken" items="${todouhukenList}"
396
+
397
+ varStatus="st">
398
+
399
+ <tr>
400
+
401
+ <td class="kennbanngo">${todouhuken.kennBanngo}</td>
402
+
403
+ <td class="kennmei">${todouhuken.kennmei}</td>
404
+
405
+ <td class="kenncyousyozaichi">${todouhuken.kenncyouSyozaichi}</td>
406
+
407
+ <td class="chihou">${todouhuken.chihou}</td>
408
+
409
+ <td class="jinnkou">${todouhuken.jinnkou}</td>
410
+
411
+ <td>
412
+
413
+ <button type="submit" name="kennBanngo"
414
+
415
+ value="${todouhuken.kennBanngo}"
416
+
417
+ onclick="submitData('./TodouhukenSearch_Details');">詳細</button>
418
+
419
+
420
+
421
+ </td>
422
+
423
+ </tr>
424
+
425
+ </c:forEach>
426
+
427
+ </form>
428
+
429
+ </tbody>
430
+
431
+ </table>
432
+
433
+ </div>
434
+
435
+ </div>
436
+
437
+ </form>
438
+
439
+ </body>
440
+
441
+ <form method="post" action="./MenuButtonClick">
442
+
443
+ <button type="submit" name="targetServletPath" value="/TodouhukenMenuInitServlet">メニューに戻る</button>
444
+
445
+ </form>
446
+
53
447
  <div
54
448
 
55
- style="background-color: #00ccff; width: *px; padding: 6px; border: 1px solid #ccc">
56
-
57
- 研修システム</div>
58
-
59
- <div
60
-
61
- style="background-color: #ffccff; width: 240px; padding: 6px; border: 1px solid #ccc">
62
-
63
- 都道府県登録</div>
64
-
65
-
66
-
67
- </head>
68
-
69
- <body>
70
-
71
-
72
-
73
-
74
-
75
- <form method="POST" action="'./TodouhukenSearch_Details'">
76
-
77
-
78
-
79
- <div>
80
-
81
- 県番号 :<input type="text" name="kennBanngo"disabled="disabled"
82
-
83
- value="<c:out value='${kennBanngo}'/>" /><br />
84
-
85
- </div>
86
-
87
- <div>
88
-
89
- 県名:<input type="text" name="kennmei"
90
-
91
- value="<c:out value='${kennmei}'/>" /> <br>
92
-
93
- </div>
94
-
95
- <div>
96
-
97
- 県庁所在地:<input type="text" name="kenncyouSyozaichi"
98
-
99
- value="<c:out value='${kenncyouSyozaichi}'/>" />
100
-
101
- </div>
102
-
103
- <div>
104
-
105
- 地方 :<input type="text" name="chihou"
106
-
107
- value="<c:out value='${chihou}'/>" /><br />
108
-
109
- <div>
110
-
111
- 人口 :<input type="text" name="jinnkou"
112
-
113
- value="<c:out value='${jinnkou}'/>" /><br />
114
-
115
- </form>
116
-
117
- <form action="#" method="post">
118
-
119
- <table>
120
-
121
- <tr>
122
-
123
- <td>
124
-
125
- <button class="btn" type="button" onclick="history.back()"
126
-
127
- style="position: absolute; left: px; bottom: 50px">一覧に戻る</button>
128
-
129
- </td>
130
-
131
- </div>
132
-
133
- <td><input type="submit" name="register" value="登録"
134
-
135
- style="position: absolute; left: 100px; bottom: 50px"></td>
136
-
137
- </tr>
138
-
139
-
140
-
141
- <c:if test="${kennBanngo >= 0}">
142
-
143
- <input type="submit" name="register" value="更新"
144
-
145
- style="position: absolute; left: 100px; bottom: 50px">
146
-
147
- <input type="submit" name="register" value="削除"
148
-
149
- style="position: absolute; left: 150px; bottom: 50px">
150
-
151
- </c:if>
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
- </table>
162
-
163
- </div>
164
-
165
- </div>
166
-
167
- <footer>
168
-
169
- <div
170
-
171
- style="position: absolute; text-align: center; bottom: 0; width: 99%; height: 30px; background-color: #00ccff">
449
+ style="position: absolute; text-align: center; bottom: 0; width: 99%; height: 30px; background-color: #00ccff">
172
-
450
+
173
- Copyright (c) training. All Rights Reserved.</div>
451
+ Copyright (c) training. All Rights Reserved.</div>
174
-
175
- </footer>
452
+
453
+
176
454
 
177
455
  </body>
178
456
 
@@ -180,356 +458,210 @@
180
458
 
181
459
  ```
182
460
 
183
- TodouhukenSearch_DetailsServlet
461
+ TodouhukenRegistLogic
184
-
462
+
185
- ```
463
+ ```
186
-
464
+
187
- package training.controller.todouhuken.regist;
465
+ package training.logic.todouhuken.regist;
188
-
189
-
190
-
191
- import java.io.IOException;
466
+
192
-
193
-
194
-
195
- import javax.servlet.RequestDispatcher;
467
+
196
-
197
- import javax.servlet.ServletException;
468
+
198
-
469
+
470
+
199
- import javax.servlet.annotation.WebServlet;
471
+ import training.common.dao.table.TodouhukenDao;
200
-
201
- import javax.servlet.http.HttpServlet;
472
+
202
-
203
- import javax.servlet.http.HttpServletRequest;
473
+ import training.common.dto.table.TodouhukenDto;
204
-
474
+
205
- import javax.servlet.http.HttpServletResponse;
475
+ import training.common.logic.BaseLogic;
206
-
207
-
208
476
 
209
477
  import training.dto.todouhuken.regist.TodouhukenRegistDto;
210
478
 
211
- import training.logic.todouhuken.regist.TodouhukenRegistLogic;
479
+
212
-
213
-
214
-
215
- /**
480
+
216
-
217
- * 都道府県一覧画面ボタン押下時処理サーブレット
218
-
219
- */
220
-
221
- @WebServlet("/TodouhukenSearch_Details")
222
-
223
- public class TodouhukenSearch_DetailsServlet extends HttpServlet {
481
+ public class TodouhukenRegistLogic extends BaseLogic {
482
+
483
+
484
+
485
+ public void getTodouhukenList(TodouhukenRegistDto dto) {
486
+
487
+
488
+
489
+ try {
490
+
491
+
492
+
493
+ getConnection();
494
+
495
+
496
+
497
+ TodouhukenDao todouhukenDao = new TodouhukenDao(con);
498
+
499
+
500
+
501
+ TodouhukenDto todouhuken = todouhukenDao.selectTodouhukenDetail(dto.getkennBanngo());
502
+
503
+
504
+
505
+ dto.setSelectTodouhukenDetail(todouhuken);
506
+
507
+
508
+
509
+ closeConnection();
510
+
511
+
512
+
513
+ } catch (Exception e) {
514
+
515
+
516
+
517
+ e.printStackTrace();
518
+
519
+ }
520
+
521
+ }
522
+
523
+ }
524
+
525
+ ```
526
+
527
+ TodouhukenRegistDto
528
+
529
+ ```
530
+
531
+ package training.dto.todouhuken.regist;
532
+
533
+
534
+
535
+ import java.io.Serializable;
536
+
537
+
538
+
539
+ import training.common.dto.table.TodouhukenDto;
540
+
541
+
542
+
543
+ public class TodouhukenRegistDto implements Serializable {
544
+
545
+
224
546
 
225
547
  private static final long serialVersionUID = 1L;
226
548
 
227
549
 
228
550
 
229
- /**
230
-
231
- * 都道府県一覧画面ボタン押下時処理
232
-
233
- *
234
-
235
- * 押下されたボタンに応じてサーブレットパスを設定し、画面遷移する。
236
-
237
- *
238
-
239
- */
240
-
241
- protected void doPost(HttpServletRequest request, HttpServletResponse response)
242
-
243
- throws ServletException, IOException {
244
-
245
-
246
-
247
- // 文字エンコードの設定(リクエスト)
248
-
249
- request.setCharacterEncoding("utf-8");
250
-
251
-
252
-
253
- // リクエストパラメータから値取得
254
-
255
- String kennBanngo = request.getParameter("kennBanngo");
256
-
257
-
258
-
259
- // 都道府県一覧画面用DTOを生成
260
-
261
- TodouhukenRegistDto dto = new TodouhukenRegistDto();
262
-
263
-
264
-
265
- // 画面入力した値を設定
266
-
267
- dto.setkennBanngo(kennBanngo);
268
-
269
-
270
-
271
- // 一覧の情報取得
272
-
273
- TodouhukenRegistLogic logic = new TodouhukenRegistLogic();
274
-
275
- logic.getTodouhukenList(dto);
276
-
277
-
278
-
279
- // 画面表示時に使用する値を設定
280
-
281
- request.setAttribute("kennBanngo", dto.getSelectTodouhukenDetail().getKennBanngo());
282
-
283
- request.setAttribute("kennmei", dto.getSelectTodouhukenDetail().getKennmei());
284
-
285
- request.setAttribute("kenncyouSyozaichi", dto.getSelectTodouhukenDetail().getKenncyouSyozaichi());
286
-
287
- request.setAttribute("chihou", dto.getSelectTodouhukenDetail().getChihou());
288
-
289
- request.setAttribute("jinnkou", dto.getSelectTodouhukenDetail().getJinnkou());
290
-
291
-
292
-
293
- // 取得した一覧を設定
294
-
295
- request.setAttribute("selectTodouhukenDetail", dto.getSelectTodouhukenDetail());
296
-
297
-
298
-
299
- // 文字エンコードの設定(レスポンス)
300
-
301
- response.setContentType("text/html; utf-8");
302
-
303
-
304
-
305
- // フォワード先をregist.jspに設定
306
-
307
- String forwardPath = "/WEB-INF/view/todouhuken_regist.jsp";
308
-
309
- RequestDispatcher dispatcher = request.getRequestDispatcher(forwardPath);
310
-
311
-
312
-
313
- // フォワード実行
314
-
315
- dispatcher.forward(request, response);
316
-
317
-
318
-
319
- }
320
-
321
-
551
+ private String kennmei = null;
552
+
553
+
554
+
555
+ public String getKennmei() {
556
+
557
+ return kennmei;
558
+
559
+ }
560
+
561
+
562
+
563
+ public void setKennmei(String kennmei) {
564
+
565
+ this.kennmei = kennmei;
566
+
567
+ }
568
+
569
+
570
+
571
+ private String chihou = null;
572
+
573
+
574
+
575
+ public String getChihou() {
576
+
577
+ return chihou;
578
+
579
+ }
580
+
581
+
582
+
583
+ public void setChihou(String chihou) {
584
+
585
+ this.chihou = chihou;
586
+
587
+ }
588
+
589
+
590
+
591
+ private String jinnkou = null;
592
+
593
+
594
+
595
+ public String getJinnkou() {
596
+
597
+ return jinnkou;
598
+
599
+ }
600
+
601
+
602
+
603
+ public void setJinnkou(String jinnkou) {
604
+
605
+ this.jinnkou = jinnkou;
606
+
607
+ }
608
+
609
+
610
+
611
+ private String kennBanngo = null;
612
+
613
+
614
+
615
+ public String getkennBanngo() {
616
+
617
+ return kennBanngo;
618
+
619
+ }
620
+
621
+
622
+
623
+ public void setkennBanngo(String kennBanngo) {
624
+
625
+ this.kennBanngo = kennBanngo;
626
+
627
+ }
628
+
629
+
630
+
631
+ private String kenncyouSyozaichi = null;
632
+
633
+
634
+
635
+ public String getkenncyouSyozaichi() {
636
+
637
+ return kenncyouSyozaichi;
638
+
639
+ }
640
+
641
+
642
+
643
+ public void setkenncyouSyozaichi(String kenncyouSyozaichi) {
644
+
645
+ this.kenncyouSyozaichi = kenncyouSyozaichi;
646
+
647
+ }
648
+
649
+
650
+
651
+ private TodouhukenDto selectTodouhukenDetail = null;
652
+
653
+ public TodouhukenDto getSelectTodouhukenDetail() {
654
+
655
+ return selectTodouhukenDetail;
656
+
657
+ }
658
+
659
+ public void setSelectTodouhukenDetail(TodouhukenDto selectTodouhukenDetail) {
660
+
661
+ this.selectTodouhukenDetail = selectTodouhukenDetail;
662
+
663
+ }
322
664
 
323
665
  }
324
666
 
325
667
  ```
326
-
327
- todouhuken_search.jsp
328
-
329
- ```
330
-
331
- <%@ page language="java" contentType="text/html; charset=utf-8"
332
-
333
- pageEncoding="utf-8"%>
334
-
335
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
336
-
337
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
338
-
339
- <html>
340
-
341
- <head>
342
-
343
- <meta http-equiv="Content-Language" content="ja"></meta>
344
-
345
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
346
-
347
- <meta name="viewport" content="width=device-width,initial-scale=1">
348
-
349
- <link rel="stylesheet" type="text/css"
350
-
351
- href="${pageContext.request.contextPath}/css/design_common.css" />
352
-
353
- <link rel="stylesheet" type="text/css"
354
-
355
- href="${pageContext.request.contextPath}/css/design_todouhuken_search.css" />
356
-
357
- <script type="text/javascript">
358
-
359
- function submitData(pAction) {
360
-
361
- document.forms[0].action = pAction;
362
-
363
- document.forms[0].submit();
364
-
365
- }
366
-
367
- </script>
368
-
369
- </head>
370
-
371
- <body>
372
-
373
- <div
374
-
375
- style="background-color: #00ccff; width: *px; padding: 10px; border: 1px solid #ccc">
376
-
377
- 研修システム</div>
378
-
379
- <div
380
-
381
- style="background-color: #ffccff; width: 240px; padding: 10px; border: 1px solid #ccc">
382
-
383
- 都道府県一覧</div>
384
-
385
- <form method="post" action="?">
386
-
387
- <div class="content">
388
-
389
- <div class="searchCond">
390
-
391
-
392
-
393
- <div class="condItem">
394
-
395
- <div>
396
-
397
- 県名:<input type="text" name="kennmei"
398
-
399
- value="<c:out value='${kennmei}'/>" />
400
-
401
- </div>
402
-
403
- <div>
404
-
405
- 地方:<input type="text" name="chihou"
406
-
407
- value="<c:out value='${chihou}'/>" />
408
-
409
- </div>
410
-
411
- <div>
412
-
413
- 人口:<input type="text" name="jinnkouFrom"
414
-
415
- value="<c:out value='${jinnkouFrom}'/>" /> ~<input type="text"
416
-
417
- name="jinnkouTo" value="<c:out value='${jinnkouTo}'/>" />
418
-
419
- </div>
420
-
421
- </div>
422
-
423
- </div>
424
-
425
-
426
-
427
- <div align="right" class="condButton">
428
-
429
- <button type="submit" name="submitButtonName" value="search"
430
-
431
- onclick="submitData('./TodouhukenSearch_Search');">検索</button>
432
-
433
- <button type="submit" name="submitButtonName" value="add"
434
-
435
- onclick="submitData('./TodouhukenSearch_Add');">追加</button>
436
-
437
- </div>
438
-
439
- </div>
440
-
441
- <div style="height: 250px; width: 600px; overflow-y: scroll;">
442
-
443
- <div class="resultList">
444
-
445
- <table class="todouhukenTable" border="1">
446
-
447
- <thead>
448
-
449
- <tr>
450
-
451
- <th class="kennbanngo" width="100">県番号</th>
452
-
453
- <th class="kennmei" width="150">県名</th>
454
-
455
- <th class="kenncyousyozaichi" width="150">県庁所在地</th>
456
-
457
- <th class="chihou" width="150">地方</th>
458
-
459
- <th class="jinnkou" width="150">人口</th>
460
-
461
- <th class="syousai" width="150">詳細</th>
462
-
463
- </tr>
464
-
465
- </thead>
466
-
467
- <tbody>
468
-
469
- <form method="post" action="?">
470
-
471
- <c:forEach var="todouhuken" items="${todouhukenList}"
472
-
473
- varStatus="st">
474
-
475
- <tr>
476
-
477
- <td class="kennbanngo">${todouhuken.kennBanngo}</td>
478
-
479
- <td class="kennmei">${todouhuken.kennmei}</td>
480
-
481
- <td class="kenncyousyozaichi">${todouhuken.kenncyouSyozaichi}</td>
482
-
483
- <td class="chihou">${todouhuken.chihou}</td>
484
-
485
- <td class="jinnkou">${todouhuken.jinnkou}</td>
486
-
487
- <td>
488
-
489
- <button type="submit" name="kennBanngo"
490
-
491
- value="${todouhuken.kennBanngo}"
492
-
493
- onclick="submitData('./TodouhukenSearch_Details');">詳細</button>
494
-
495
-
496
-
497
- </td>
498
-
499
- </tr>
500
-
501
- </c:forEach>
502
-
503
- </form>
504
-
505
- </tbody>
506
-
507
- </table>
508
-
509
- </div>
510
-
511
- </div>
512
-
513
- </form>
514
-
515
- </body>
516
-
517
- <form method="post" action="./MenuButtonClick">
518
-
519
- <button type="submit" name="targetServletPath" value="/TodouhukenMenuInitServlet">メニューに戻る</button>
520
-
521
- </form>
522
-
523
- <div
524
-
525
- style="position: absolute; text-align: center; bottom: 0; width: 99%; height: 30px; background-color: #00ccff">
526
-
527
- Copyright (c) training. All Rights Reserved.</div>
528
-
529
-
530
-
531
- </body>
532
-
533
- </html>
534
-
535
- ```

1

説明の追記

2020/06/24 05:04

投稿

aaaajj
aaaajj

スコア5

test CHANGED
File without changes
test CHANGED
@@ -1,10 +1,18 @@
1
1
  ### 詳細ボタンを押した県の情報を表示したい
2
2
 
3
+ todouhuken_search.jspでテーブル検索をした後
4
+
5
+ todouhuken_search.jspの詳細ボタンを押下時に、
6
+
3
- 検索画面jspでテーブル検索をした後の詳細ボタンを押下時に、県番号をサーブレットから登録画面のjspに値を渡し押した県の詳細を表示させたいです。
7
+ 県番号をサーブレットからtodouhuken_regist.jspに値を渡し押した県の詳細を表示させたいです。
8
+
9
+
10
+
4
-
11
+ todouhuken_search.jsp:検索画面
12
+
5
-
13
+ todouhuken_regist.jsp:登録画面
14
+
6
-
15
+ TodouhukenSearch_DetailsServlet:サーブレット
7
-
8
16
 
9
17
  ### 発生している問題・エラーメッセージ
10
18
 
@@ -16,7 +24,7 @@
16
24
 
17
25
  ### 該当のソースコード
18
26
 
19
-
27
+ todouhuken_regist.jsp
20
28
 
21
29
  ```ここに言語名を入力
22
30
 
@@ -172,6 +180,8 @@
172
180
 
173
181
  ```
174
182
 
183
+ TodouhukenSearch_DetailsServlet
184
+
175
185
  ```
176
186
 
177
187
  package training.controller.todouhuken.regist;
@@ -314,6 +324,8 @@
314
324
 
315
325
  ```
316
326
 
327
+ todouhuken_search.jsp
328
+
317
329
  ```
318
330
 
319
331
  <%@ page language="java" contentType="text/html; charset=utf-8"