質問編集履歴
2
EmployeeInfoクラスを追加しました(文字数の関係上、EmployeeServletControlを削除)
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,666 +28,548 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
```Employee
|
31
|
+
```EmployeeListDAO
|
32
|
+
|
33
|
+
|
34
|
+
|
32
|
-
|
35
|
+
public class EmployeeListDAO {
|
36
|
+
|
37
|
+
|
38
|
+
|
33
|
-
|
39
|
+
//定数宣言
|
40
|
+
|
34
|
-
|
41
|
+
private final String useSSL = "";
|
42
|
+
|
35
|
-
pr
|
43
|
+
private final String userName = "";
|
44
|
+
|
36
|
-
|
45
|
+
private final String password = "";
|
46
|
+
|
47
|
+
private final String jdbcDriver = "";
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
public EmployeeInfo employeeGet(String employee_id) throws Exception{
|
52
|
+
|
53
|
+
|
54
|
+
|
37
|
-
|
55
|
+
EmployeeInfo employeeInfo = null;
|
56
|
+
|
38
|
-
|
57
|
+
Connection conn = null;
|
58
|
+
|
39
|
-
|
59
|
+
PreparedStatement pStmt = null;
|
60
|
+
|
61
|
+
ResultSet rs = null;
|
62
|
+
|
63
|
+
int employeeId ;
|
40
64
|
|
41
65
|
|
42
66
|
|
43
67
|
try {
|
44
68
|
|
45
|
-
//
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
69
|
+
//社員IDをint型へ変換
|
70
|
+
|
71
|
+
employeeId = Integer.parseInt(employee_id);
|
72
|
+
|
73
|
+
//JDBCドライバを読み込む
|
74
|
+
|
75
|
+
Class.forName(jdbcDriver);
|
76
|
+
|
77
|
+
//データベース接続
|
78
|
+
|
79
|
+
conn = DriverManager.getConnection(useSSL,userName,password);
|
80
|
+
|
81
|
+
//SELECT文を準備
|
82
|
+
|
83
|
+
String sql = "SELECT E1.EMPLOYEE_ID,E1.NAME,E1.NAME_HIRAGANA,E1.BIRTHDAY,E1.SEX,E1.MAIL_ADDRESS,E1.TELEPHONE_NUMBER,E1.COMPANY_INFO_ID,E1.BUSINESS_MANAGER,E1.DEPARTMENT,E1.COMMISSIONING_STATUS,E2.ENTER_DATE,E2.RETIRE_DATE,E2.STATUS " +
|
84
|
+
|
85
|
+
"FROM EMPLOYEE_INFO AS E1 " +
|
86
|
+
|
87
|
+
"INNER JOIN EMPLOYEE_STATE AS E2 " +
|
88
|
+
|
89
|
+
"ON E1.EMPLOYEE_ID = E2.EMPLOYEE_INFO_ID " +
|
90
|
+
|
91
|
+
"WHERE E1.EMPLOYEE_ID = ?;";
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
//SQLを設定
|
96
|
+
|
97
|
+
pStmt = conn.prepareStatement(sql);
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
//パラメータをセット
|
102
|
+
|
103
|
+
pStmt.setInt(1,employeeId);
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
//SELECT文を実行し、結果表を取得
|
108
|
+
|
109
|
+
rs = pStmt.executeQuery();
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
//取り出したデータをemployeeListに設置
|
114
|
+
|
115
|
+
if(rs.next()) {
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
//結果表からデータを取得
|
120
|
+
|
121
|
+
String name = rs.getString("NAME");
|
122
|
+
|
123
|
+
String name_hiragana = rs.getString("NAME_HIRAGANA");
|
124
|
+
|
125
|
+
String sex = rs.getString("SEX");
|
126
|
+
|
127
|
+
String mail_address = rs.getString("MAIL_ADDRESS");
|
128
|
+
|
129
|
+
String business_manager = rs.getString("BUSINESS_MANAGER");
|
130
|
+
|
131
|
+
String telephone_number = rs.getString("TELEPHONE_NUMBER");
|
132
|
+
|
133
|
+
String birthday = rs.getString("BIRTHDAY");
|
134
|
+
|
135
|
+
String enter_date = rs.getString("ENTER_DATE");
|
136
|
+
|
137
|
+
String retire_date = rs.getString("RETIRE_DATE");
|
138
|
+
|
139
|
+
String company_info_id = rs.getString("COMPANY_INFO_ID");
|
140
|
+
|
141
|
+
String department = rs.getString("DEPARTMENT");
|
142
|
+
|
143
|
+
String commissioning_status = rs.getString("COMMISSIONING_STATUS");
|
144
|
+
|
145
|
+
String status = rs.getString("STATUS");
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
employeeInfo = new EmployeeInfo(employeeId,name,name_hiragana,sex,mail_address,business_manager,telephone_number,birthday,enter_date,retire_date,company_info_id,department,commissioning_status,status);
|
56
150
|
|
57
151
|
}
|
58
152
|
|
59
|
-
|
60
|
-
|
61
|
-
/*"command"の値によって一覧画面の表示、詳細画面の表示
|
62
|
-
|
63
|
-
* 社員データの削除を実行
|
64
|
-
|
65
|
-
*/
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
switch (theCommand) {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
case "LIST":
|
74
|
-
|
75
|
-
employeeList(request,response);
|
76
|
-
|
77
|
-
|
153
|
+
else {
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
154
|
+
|
82
|
-
|
83
|
-
employeeLoad(request,response);
|
84
|
-
|
85
|
-
break;
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
/**
|
90
|
-
|
91
|
-
|
155
|
+
throw new Exception("社員IDが見つかりませんでした:"+ employeeId);
|
92
|
-
|
93
|
-
*/
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
default:
|
98
|
-
|
99
|
-
employeeList(request,response);
|
100
156
|
|
101
157
|
}
|
102
158
|
|
103
|
-
|
159
|
+
}finally {
|
160
|
+
|
104
|
-
|
161
|
+
//データベースを切断
|
162
|
+
|
163
|
+
if(conn != null) {
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
try {
|
168
|
+
|
169
|
+
conn.close();
|
170
|
+
|
171
|
+
|
172
|
+
|
105
|
-
}catch(Exception e
|
173
|
+
}catch(SQLException e) {
|
106
|
-
|
174
|
+
|
107
|
-
|
175
|
+
e.printStackTrace();
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
return null;
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
}
|
108
184
|
|
109
185
|
}
|
110
186
|
|
187
|
+
return employeeInfo;
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
```
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
```detail
|
200
|
+
|
201
|
+
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
202
|
+
|
203
|
+
pageEncoding="UTF-8"%>
|
204
|
+
|
205
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
206
|
+
|
207
|
+
<!DOCTYPE html>
|
208
|
+
|
209
|
+
<html>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<head>
|
214
|
+
|
215
|
+
<meta charset="UTF-8">
|
216
|
+
|
217
|
+
<title>社員詳細</title>
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
<link type="text/css" rel="stylesheet" href="css/style.css">
|
222
|
+
|
223
|
+
<link type="text/css" rel="stylesheet" href="css/add-employee-style.css">
|
224
|
+
|
225
|
+
</head>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<body>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<div id="container">
|
234
|
+
|
235
|
+
<h3>社員詳細</h3>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<form action="EmployeeControlServlet" method="POST">
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
<c:choose>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
<c:when test="${THE_EMPLOYEE.employee_id == null }">
|
248
|
+
|
249
|
+
<input type="hidden" name="command" value="ADD" />
|
250
|
+
|
251
|
+
</c:when>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<c:when test="${THE_EMPLOYEE.employee_id != null }">
|
256
|
+
|
257
|
+
<input type="hidden" name="command" value="UPDATE" />
|
258
|
+
|
259
|
+
<input type="hidden" name="employee_id"
|
260
|
+
|
261
|
+
value="${THE_EMPLOYEE.employee_id}" />
|
262
|
+
|
263
|
+
</c:when>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
<c:otherwise>
|
268
|
+
|
269
|
+
エラーが発生しました
|
270
|
+
|
271
|
+
</c:otherwise>
|
272
|
+
|
273
|
+
</c:choose>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<table>
|
278
|
+
|
279
|
+
<tbody>
|
280
|
+
|
281
|
+
<tr>
|
282
|
+
|
283
|
+
<td><label>氏名</label></td>
|
284
|
+
|
285
|
+
<td><input type="text" name="name"
|
286
|
+
|
287
|
+
value="${THE_EMPLOYEE.name }" maxlength="20" /></td>
|
288
|
+
|
289
|
+
</tr>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
<tr>
|
294
|
+
|
295
|
+
<td><label>氏名(ひらがな)</label></td>
|
296
|
+
|
297
|
+
<td><input type="text" name="name_hiragana"
|
298
|
+
|
299
|
+
value="${THE_EMPLOYEE.name_hiragana }" maxlength="20" /></td>
|
300
|
+
|
301
|
+
</tr>
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
<tr>
|
306
|
+
|
307
|
+
<td><label>生年月日</label></td>
|
308
|
+
|
309
|
+
<td><input type="text" name="birthday"
|
310
|
+
|
311
|
+
value="${THE_EMPLOYEE.birthday }" maxlength="10" /></td>
|
312
|
+
|
313
|
+
</tr>
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
<tr>
|
318
|
+
|
319
|
+
<td><label>性別</label></td>
|
320
|
+
|
321
|
+
<td><input type="radio" name="sex"
|
322
|
+
|
323
|
+
<c:if test="${THE_EMPLOYEE.sex != '1'}">checked</c:if> value="0" />
|
324
|
+
|
325
|
+
男 <input type="radio" name="sex"
|
326
|
+
|
327
|
+
<c:if test="${THE_EMPLOYEE.sex == '1'}">checked</c:if> value="1" />
|
328
|
+
|
329
|
+
女</td>
|
330
|
+
|
331
|
+
</tr>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
<tr>
|
336
|
+
|
337
|
+
<td><label>メールアドレス</label></td>
|
338
|
+
|
339
|
+
<td><input type="text" name="mail_address"
|
340
|
+
|
341
|
+
value="${THE_EMPLOYEE.mail_address }" maxlength="50" /></td>
|
342
|
+
|
343
|
+
</tr>
|
344
|
+
|
345
|
+
<tr>
|
346
|
+
|
347
|
+
<td><label>電話番号</label></td>
|
348
|
+
|
349
|
+
<td><input type="text" name="telephone_number"
|
350
|
+
|
351
|
+
value="${THE_EMPLOYEE.telephone_number }" maxlength="13" /></td>
|
352
|
+
|
353
|
+
</tr>
|
354
|
+
|
355
|
+
```
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
```EmployeeInfo
|
360
|
+
|
361
|
+
public class EmployeeInfo implements Serializable{
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
private int employee_id; //社員ID employee_info
|
366
|
+
|
367
|
+
private String name; //氏名 employee_info
|
368
|
+
|
369
|
+
private String name_hiragana; //氏名(ひらがな) employee_info
|
370
|
+
|
371
|
+
private String business_manager; //担当管理営業 employee_info
|
372
|
+
|
373
|
+
private String birthday; //生年月日 employee_info
|
374
|
+
|
375
|
+
private String sex; //性別 employee_info
|
376
|
+
|
377
|
+
private String mail_address; //メールアドレス employee_info
|
378
|
+
|
379
|
+
private String telephone_number; //電話番号 employee_info
|
380
|
+
|
381
|
+
private String enter_date; //入社日 employee_state
|
382
|
+
|
383
|
+
private String retire_date; //退社日 employee_state
|
384
|
+
|
385
|
+
private String company_info_id; //所属会社ID employee_info
|
386
|
+
|
387
|
+
private String department; //事業部 employee_info
|
388
|
+
|
389
|
+
private String commissioning_status; //稼働状況 employee_info
|
390
|
+
|
391
|
+
private String status; //ステータス employee_state
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
public EmployeeInfo() {
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
}
|
402
|
+
|
111
403
|
|
112
404
|
|
113
405
|
/**
|
114
406
|
|
115
|
-
* 社員
|
407
|
+
* 社員リストメソッド
|
408
|
+
|
409
|
+
* list.jsp表示用
|
116
410
|
|
117
411
|
*
|
118
412
|
|
413
|
+
* @param employee_id
|
414
|
+
|
415
|
+
* @param name
|
416
|
+
|
417
|
+
* @param name_hiragana
|
418
|
+
|
419
|
+
* @param business_manager
|
420
|
+
|
421
|
+
* @param birthday
|
422
|
+
|
423
|
+
* @param enter_date
|
424
|
+
|
425
|
+
* @param company_info_id
|
426
|
+
|
119
|
-
* @param re
|
427
|
+
* @param department
|
120
|
-
|
428
|
+
|
121
|
-
* @param
|
429
|
+
* @param commissioning_status
|
122
|
-
|
123
|
-
* @return なし
|
124
|
-
|
125
|
-
* @throws ServletException
|
126
|
-
|
127
|
-
* @throws IOException
|
128
430
|
|
129
431
|
*/
|
130
432
|
|
131
|
-
p
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
433
|
+
public EmployeeInfo(int employee_id, String name,String name_hiragana, String business_manager,String birthday,String enter_date,String company_info_id,String department,String commissioning_status) {
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
this.employee_id = employee_id;
|
438
|
+
|
439
|
+
this.name = name;
|
440
|
+
|
441
|
+
this.name_hiragana = name_hiragana;
|
442
|
+
|
443
|
+
this.business_manager = business_manager;
|
444
|
+
|
445
|
+
this.birthday = birthday;
|
446
|
+
|
447
|
+
this.enter_date = enter_date;
|
448
|
+
|
449
|
+
this.company_info_id = company_info_id;
|
450
|
+
|
451
|
+
this.department = department;
|
452
|
+
|
453
|
+
this.commissioning_status = commissioning_status;
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
}
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
/**
|
462
|
+
|
463
|
+
* 社員リストメソッド
|
464
|
+
|
465
|
+
* detail.jsp用
|
466
|
+
|
467
|
+
*
|
468
|
+
|
469
|
+
* @param name
|
470
|
+
|
471
|
+
* @param name_hiragana
|
472
|
+
|
473
|
+
* @param business_manager
|
474
|
+
|
475
|
+
* @param birthday
|
476
|
+
|
477
|
+
* @param sex
|
478
|
+
|
479
|
+
* @param mail_address
|
480
|
+
|
481
|
+
* @param tel_number
|
482
|
+
|
483
|
+
* @param company
|
484
|
+
|
485
|
+
* @param enter_date
|
486
|
+
|
487
|
+
* @param retire_date
|
488
|
+
|
489
|
+
* @param company_info_id
|
490
|
+
|
491
|
+
* @param department
|
492
|
+
|
493
|
+
* @param commissioning_status
|
494
|
+
|
495
|
+
* @param status
|
496
|
+
|
497
|
+
*/
|
498
|
+
|
499
|
+
public EmployeeInfo(String name,String name_hiragana, String business_manager,String birthday,String sex,String mail_address,String telephone_number,String enter_date,String retire_date,String company_info_id,String department,String commissioning_status,String status) {
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
this.name = name;
|
504
|
+
|
505
|
+
this.name_hiragana = name_hiragana;
|
506
|
+
|
507
|
+
this.sex = sex;
|
508
|
+
|
509
|
+
this.mail_address = mail_address;
|
510
|
+
|
511
|
+
this.business_manager = business_manager;
|
512
|
+
|
513
|
+
this.telephone_number = telephone_number;
|
514
|
+
|
515
|
+
this.birthday = birthday;
|
516
|
+
|
517
|
+
this.enter_date = enter_date;
|
518
|
+
|
519
|
+
this.retire_date = retire_date;
|
520
|
+
|
521
|
+
this.company_info_id = company_info_id;
|
522
|
+
|
523
|
+
this.department = department;
|
524
|
+
|
525
|
+
this.commissioning_status = commissioning_status;
|
526
|
+
|
527
|
+
this.status = status;
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
}
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
public EmployeeInfo(int employee_id,String name,String name_hiragana, String business_manager,String birthday,String sex,String mail_address,String telephone_number,String enter_date,String retire_date,String company_info_id,String department,String commissioning_status,String status) {
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
this.employee_id = employee_id;
|
540
|
+
|
541
|
+
this.name = name;
|
542
|
+
|
543
|
+
this.name_hiragana = name_hiragana;
|
544
|
+
|
545
|
+
this.sex = sex;
|
546
|
+
|
547
|
+
this.mail_address = mail_address;
|
548
|
+
|
549
|
+
this.business_manager = business_manager;
|
550
|
+
|
551
|
+
this.telephone_number = telephone_number;
|
552
|
+
|
553
|
+
this.birthday = birthday;
|
554
|
+
|
555
|
+
this.enter_date = enter_date;
|
556
|
+
|
557
|
+
this.retire_date = retire_date;
|
558
|
+
|
559
|
+
this.company_info_id = company_info_id;
|
560
|
+
|
561
|
+
this.department = department;
|
562
|
+
|
563
|
+
this.commissioning_status = commissioning_status;
|
564
|
+
|
565
|
+
this.status = status;
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
}
|
570
|
+
|
571
|
+
|
166
572
|
|
167
573
|
}
|
168
574
|
|
169
575
|
```
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
```EmployeeListDAO
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
public class EmployeeListDAO {
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
//定数宣言
|
182
|
-
|
183
|
-
private final String useSSL = "";
|
184
|
-
|
185
|
-
private final String userName = "";
|
186
|
-
|
187
|
-
private final String password = "";
|
188
|
-
|
189
|
-
private final String jdbcDriver = "";
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
public EmployeeInfo employeeGet(String employee_id) throws Exception{
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
EmployeeInfo employeeInfo = null;
|
198
|
-
|
199
|
-
Connection conn = null;
|
200
|
-
|
201
|
-
PreparedStatement pStmt = null;
|
202
|
-
|
203
|
-
ResultSet rs = null;
|
204
|
-
|
205
|
-
int employeeId ;
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
try {
|
210
|
-
|
211
|
-
//社員IDをint型へ変換
|
212
|
-
|
213
|
-
employeeId = Integer.parseInt(employee_id);
|
214
|
-
|
215
|
-
//JDBCドライバを読み込む
|
216
|
-
|
217
|
-
Class.forName(jdbcDriver);
|
218
|
-
|
219
|
-
//データベース接続
|
220
|
-
|
221
|
-
conn = DriverManager.getConnection(useSSL,userName,password);
|
222
|
-
|
223
|
-
//SELECT文を準備
|
224
|
-
|
225
|
-
String sql = "SELECT E1.EMPLOYEE_ID,E1.NAME,E1.NAME_HIRAGANA,E1.BIRTHDAY,E1.SEX,E1.MAIL_ADDRESS,E1.TELEPHONE_NUMBER,E1.COMPANY_INFO_ID,E1.BUSINESS_MANAGER,E1.DEPARTMENT,E1.COMMISSIONING_STATUS,E2.ENTER_DATE,E2.RETIRE_DATE,E2.STATUS " +
|
226
|
-
|
227
|
-
"FROM EMPLOYEE_INFO AS E1 " +
|
228
|
-
|
229
|
-
"INNER JOIN EMPLOYEE_STATE AS E2 " +
|
230
|
-
|
231
|
-
"ON E1.EMPLOYEE_ID = E2.EMPLOYEE_INFO_ID " +
|
232
|
-
|
233
|
-
"WHERE E1.EMPLOYEE_ID = ?;";
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
//SQLを設定
|
238
|
-
|
239
|
-
pStmt = conn.prepareStatement(sql);
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
//パラメータをセット
|
244
|
-
|
245
|
-
pStmt.setInt(1,employeeId);
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
//SELECT文を実行し、結果表を取得
|
250
|
-
|
251
|
-
rs = pStmt.executeQuery();
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
//取り出したデータをemployeeListに設置
|
256
|
-
|
257
|
-
if(rs.next()) {
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
//結果表からデータを取得
|
262
|
-
|
263
|
-
String name = rs.getString("NAME");
|
264
|
-
|
265
|
-
String name_hiragana = rs.getString("NAME_HIRAGANA");
|
266
|
-
|
267
|
-
String sex = rs.getString("SEX");
|
268
|
-
|
269
|
-
String mail_address = rs.getString("MAIL_ADDRESS");
|
270
|
-
|
271
|
-
String business_manager = rs.getString("BUSINESS_MANAGER");
|
272
|
-
|
273
|
-
String telephone_number = rs.getString("TELEPHONE_NUMBER");
|
274
|
-
|
275
|
-
String birthday = rs.getString("BIRTHDAY");
|
276
|
-
|
277
|
-
String enter_date = rs.getString("ENTER_DATE");
|
278
|
-
|
279
|
-
String retire_date = rs.getString("RETIRE_DATE");
|
280
|
-
|
281
|
-
String company_info_id = rs.getString("COMPANY_INFO_ID");
|
282
|
-
|
283
|
-
String department = rs.getString("DEPARTMENT");
|
284
|
-
|
285
|
-
String commissioning_status = rs.getString("COMMISSIONING_STATUS");
|
286
|
-
|
287
|
-
String status = rs.getString("STATUS");
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
employeeInfo = new EmployeeInfo(employeeId,name,name_hiragana,sex,mail_address,business_manager,telephone_number,birthday,enter_date,retire_date,company_info_id,department,commissioning_status,status);
|
292
|
-
|
293
|
-
}
|
294
|
-
|
295
|
-
else {
|
296
|
-
|
297
|
-
throw new Exception("社員IDが見つかりませんでした:"+ employeeId);
|
298
|
-
|
299
|
-
}
|
300
|
-
|
301
|
-
}finally {
|
302
|
-
|
303
|
-
//データベースを切断
|
304
|
-
|
305
|
-
if(conn != null) {
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
try {
|
310
|
-
|
311
|
-
conn.close();
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
}catch(SQLException e) {
|
316
|
-
|
317
|
-
e.printStackTrace();
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
return null;
|
322
|
-
|
323
|
-
}
|
324
|
-
|
325
|
-
}
|
326
|
-
|
327
|
-
}
|
328
|
-
|
329
|
-
return employeeInfo;
|
330
|
-
|
331
|
-
}
|
332
|
-
|
333
|
-
}
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
```
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
```detail
|
342
|
-
|
343
|
-
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
344
|
-
|
345
|
-
pageEncoding="UTF-8"%>
|
346
|
-
|
347
|
-
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
348
|
-
|
349
|
-
<!DOCTYPE html>
|
350
|
-
|
351
|
-
<html>
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
<head>
|
356
|
-
|
357
|
-
<meta charset="UTF-8">
|
358
|
-
|
359
|
-
<title>社員詳細</title>
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
<link type="text/css" rel="stylesheet" href="css/style.css">
|
364
|
-
|
365
|
-
<link type="text/css" rel="stylesheet" href="css/add-employee-style.css">
|
366
|
-
|
367
|
-
</head>
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
<body>
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
<div id="container">
|
376
|
-
|
377
|
-
<h3>社員詳細</h3>
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
<form action="EmployeeControlServlet" method="POST">
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
<c:choose>
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
<c:when test="${THE_EMPLOYEE.employee_id == null }">
|
390
|
-
|
391
|
-
<input type="hidden" name="command" value="ADD" />
|
392
|
-
|
393
|
-
</c:when>
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
<c:when test="${THE_EMPLOYEE.employee_id != null }">
|
398
|
-
|
399
|
-
<input type="hidden" name="command" value="UPDATE" />
|
400
|
-
|
401
|
-
<input type="hidden" name="employee_id"
|
402
|
-
|
403
|
-
value="${THE_EMPLOYEE.employee_id}" />
|
404
|
-
|
405
|
-
</c:when>
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
<c:otherwise>
|
410
|
-
|
411
|
-
エラーが発生しました
|
412
|
-
|
413
|
-
</c:otherwise>
|
414
|
-
|
415
|
-
</c:choose>
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
<table>
|
420
|
-
|
421
|
-
<tbody>
|
422
|
-
|
423
|
-
<tr>
|
424
|
-
|
425
|
-
<td><label>氏名</label></td>
|
426
|
-
|
427
|
-
<td><input type="text" name="name"
|
428
|
-
|
429
|
-
value="${THE_EMPLOYEE.name }" maxlength="20" /></td>
|
430
|
-
|
431
|
-
</tr>
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
<tr>
|
436
|
-
|
437
|
-
<td><label>氏名(ひらがな)</label></td>
|
438
|
-
|
439
|
-
<td><input type="text" name="name_hiragana"
|
440
|
-
|
441
|
-
value="${THE_EMPLOYEE.name_hiragana }" maxlength="20" /></td>
|
442
|
-
|
443
|
-
</tr>
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
<tr>
|
448
|
-
|
449
|
-
<td><label>生年月日</label></td>
|
450
|
-
|
451
|
-
<td><input type="text" name="birthday"
|
452
|
-
|
453
|
-
value="${THE_EMPLOYEE.birthday }" maxlength="10" /></td>
|
454
|
-
|
455
|
-
</tr>
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
<tr>
|
460
|
-
|
461
|
-
<td><label>性別</label></td>
|
462
|
-
|
463
|
-
<td><input type="radio" name="sex"
|
464
|
-
|
465
|
-
<c:if test="${THE_EMPLOYEE.sex != '1'}">checked</c:if> value="0" />
|
466
|
-
|
467
|
-
男 <input type="radio" name="sex"
|
468
|
-
|
469
|
-
<c:if test="${THE_EMPLOYEE.sex == '1'}">checked</c:if> value="1" />
|
470
|
-
|
471
|
-
女</td>
|
472
|
-
|
473
|
-
</tr>
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
<tr>
|
478
|
-
|
479
|
-
<td><label>メールアドレス</label></td>
|
480
|
-
|
481
|
-
<td><input type="text" name="mail_address"
|
482
|
-
|
483
|
-
value="${THE_EMPLOYEE.mail_address }" maxlength="50" /></td>
|
484
|
-
|
485
|
-
</tr>
|
486
|
-
|
487
|
-
<tr>
|
488
|
-
|
489
|
-
<td><label>電話番号</label></td>
|
490
|
-
|
491
|
-
<td><input type="text" name="telephone_number"
|
492
|
-
|
493
|
-
value="${THE_EMPLOYEE.telephone_number }" maxlength="13" /></td>
|
494
|
-
|
495
|
-
</tr>
|
496
|
-
|
497
|
-
<tr>
|
498
|
-
|
499
|
-
<td><label>所属会社</label></td>
|
500
|
-
|
501
|
-
<td><select name="company_info_id">
|
502
|
-
|
503
|
-
<option
|
504
|
-
|
505
|
-
<c:if test="${THE_EMPLOYEE.company_info_id == '1'}">selected</c:if>
|
506
|
-
|
507
|
-
value="1">PDA</option>
|
508
|
-
|
509
|
-
<option
|
510
|
-
|
511
|
-
<c:if test="${THE_EMPLOYEE.company_info_id == '2'}">selected</c:if>
|
512
|
-
|
513
|
-
value="2">PGO</option>
|
514
|
-
|
515
|
-
<option
|
516
|
-
|
517
|
-
<c:if test="${THE_EMPLOYEE.company_info_id == '3'}">selected</c:if>
|
518
|
-
|
519
|
-
value="3">PLK</option>
|
520
|
-
|
521
|
-
<option
|
522
|
-
|
523
|
-
<c:if test="${THE_EMPLOYEE.company_info_id == '4'}">selected</c:if>
|
524
|
-
|
525
|
-
value="4">PRG</option>
|
526
|
-
|
527
|
-
</select></td>
|
528
|
-
|
529
|
-
</tr>
|
530
|
-
|
531
|
-
<tr>
|
532
|
-
|
533
|
-
<td><label>担当管理営業</label></td>
|
534
|
-
|
535
|
-
<td><input type="text" name="business_manager"
|
536
|
-
|
537
|
-
value="${THE_EMPLOYEE.business_manager }" maxlength="20" /></td>
|
538
|
-
|
539
|
-
</tr>
|
540
|
-
|
541
|
-
<tr>
|
542
|
-
|
543
|
-
<td><label>事業部</label></td>
|
544
|
-
|
545
|
-
<td><select name="department">
|
546
|
-
|
547
|
-
<option
|
548
|
-
|
549
|
-
<c:if test="${THE_EMPLOYEE.department == '0'}">selected</c:if>
|
550
|
-
|
551
|
-
value="0">開発</option>
|
552
|
-
|
553
|
-
<option
|
554
|
-
|
555
|
-
<c:if test="${THE_EMPLOYEE.department == '1'}">selected</c:if>
|
556
|
-
|
557
|
-
value="1">NW</option>
|
558
|
-
|
559
|
-
<option
|
560
|
-
|
561
|
-
<c:if test="${THE_EMPLOYEE.department == '2'}">selected</c:if>
|
562
|
-
|
563
|
-
value="2">検証</option>
|
564
|
-
|
565
|
-
<option
|
566
|
-
|
567
|
-
<c:if test="${THE_EMPLOYEE.department == '3'}">selected</c:if>
|
568
|
-
|
569
|
-
value="3">オフィス</option>
|
570
|
-
|
571
|
-
<option
|
572
|
-
|
573
|
-
<c:if test="${THE_EMPLOYEE.department == '4'}">selected</c:if>
|
574
|
-
|
575
|
-
value="4">管理</option>
|
576
|
-
|
577
|
-
</select></td>
|
578
|
-
|
579
|
-
</tr>
|
580
|
-
|
581
|
-
<tr>
|
582
|
-
|
583
|
-
<td><label>稼働状況</label></td>
|
584
|
-
|
585
|
-
<td><input type="radio" name="commissioning_status"
|
586
|
-
|
587
|
-
<c:if test="${THE_EMPLOYEE.commissioning_status != '0'}">checked</c:if>
|
588
|
-
|
589
|
-
value="0" />稼働 <input type="radio" name="commissioning_status"
|
590
|
-
|
591
|
-
<c:if test="${THE_EMPLOYEE.commissioning_status == '0'}">checked</c:if>
|
592
|
-
|
593
|
-
value="1" />未稼働</td>
|
594
|
-
|
595
|
-
</tr>
|
596
|
-
|
597
|
-
<tr>
|
598
|
-
|
599
|
-
<td><label>入社日</label></td>
|
600
|
-
|
601
|
-
<td><input type="text" name="enter_date"
|
602
|
-
|
603
|
-
value="${THE_EMPLOYEE.enter_date }" maxlength="10" /></td>
|
604
|
-
|
605
|
-
</tr>
|
606
|
-
|
607
|
-
<tr>
|
608
|
-
|
609
|
-
<td><label>退職日</label></td>
|
610
|
-
|
611
|
-
<td><input type="text" name="retire_date"
|
612
|
-
|
613
|
-
value="${THE_EMPLOYEE.retire_date }" maxlength="10" /></td>
|
614
|
-
|
615
|
-
</tr>
|
616
|
-
|
617
|
-
<tr>
|
618
|
-
|
619
|
-
<td><label>ステータス</label></td>
|
620
|
-
|
621
|
-
<td><select name="status">
|
622
|
-
|
623
|
-
<option
|
624
|
-
|
625
|
-
<c:if test="${THE_EMPLOYEE.status == '0'}" >selected</c:if>
|
626
|
-
|
627
|
-
value="0">在籍</option>
|
628
|
-
|
629
|
-
<option
|
630
|
-
|
631
|
-
<c:if test="${THE_EMPLOYEE.status == '1'}" >selected</c:if>
|
632
|
-
|
633
|
-
value="1">退職</option>
|
634
|
-
|
635
|
-
<option
|
636
|
-
|
637
|
-
<c:if test="${THE_EMPLOYEE.status == '2'}" >selected</c:if>
|
638
|
-
|
639
|
-
value="2">入社待ち</option>
|
640
|
-
|
641
|
-
<option
|
642
|
-
|
643
|
-
<c:if test="${THE_EMPLOYEE.status == '3'}" >selected</c:if>
|
644
|
-
|
645
|
-
value="3">入社取り消し</option>
|
646
|
-
|
647
|
-
</select></td>
|
648
|
-
|
649
|
-
</tr>
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
<tr>
|
656
|
-
|
657
|
-
<td><label></label></td>
|
658
|
-
|
659
|
-
<td><input type="submit" value="登録" class="save" /></td>
|
660
|
-
|
661
|
-
</tr>
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
</tbody>
|
666
|
-
|
667
|
-
</table>
|
668
|
-
|
669
|
-
</form>
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
<div style="clear: both;"></div>
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
<p>
|
678
|
-
|
679
|
-
<a href="EmployeeControlServlet">戻る</a>
|
680
|
-
|
681
|
-
</p>
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
</div>
|
686
|
-
|
687
|
-
</body>
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
</html>
|
692
|
-
|
693
|
-
```
|
1
DB接続情報を削除しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -180,13 +180,13 @@
|
|
180
180
|
|
181
181
|
//定数宣言
|
182
182
|
|
183
|
-
private final String useSSL = "
|
183
|
+
private final String useSSL = "";
|
184
|
-
|
184
|
+
|
185
|
-
private final String userName = "
|
185
|
+
private final String userName = "";
|
186
|
-
|
186
|
+
|
187
|
-
private final String password = "
|
187
|
+
private final String password = "";
|
188
|
-
|
188
|
+
|
189
|
-
private final String jdbcDriver = "
|
189
|
+
private final String jdbcDriver = "";
|
190
190
|
|
191
191
|
|
192
192
|
|