質問編集履歴

5

10/1追加

2019/10/01 01:49

投稿

usako
usako

スコア31

test CHANGED
File without changes
test CHANGED
@@ -178,8 +178,6 @@
178
178
 
179
179
  <!-- add -->
180
180
 
181
-
182
-
183
181
  <!-- AspectJ -->
184
182
 
185
183
  <dependency>
@@ -432,151 +430,93 @@
432
430
 
433
431
  ```
434
432
 
435
- 927日追記
433
+ 101日追記
436
434
 
437
435
  ```
438
436
 
439
- (Addressbook.java)
440
-
441
- package jp.practice.address;
442
-
443
-
444
-
445
- import java.util.List;
446
-
447
- import java.util.Map;
448
-
449
-
450
-
451
- import javax.validation.Valid;
452
-
453
-
454
-
455
- import org.springframework.stereotype.Controller;
456
-
457
- import org.springframework.ui.Model;
458
-
459
- import org.springframework.validation.BindingResult;
460
-
461
- import org.springframework.web.bind.annotation.RequestMapping;
462
-
463
-
464
-
465
- @Controller
466
-
467
- @RequestMapping(value = "/book")
468
-
469
- public class AddressBookController {
470
-
471
- private static final String INIT = "init";
472
-
473
- private static final String REFER = "refer";
474
-
475
- private static final String UPDATE = "update";
476
-
477
- private static final String LIST = "list";
478
-
479
- private static final String INIMSG = "従業員番号を入力してください";
480
-
481
- private static final String REFMSG = "情報が取得できました";
482
-
483
- private static final String UPDMSG = "情報を更新してください";
484
-
485
- private static final String ERRMSG = "該当するデータはありません";
486
-
487
- private RecordManager recordManager;
488
-
489
-
490
-
491
- private DepartmentInfoGet departmentInfoGet;
492
-
493
- public AddressBookController(RecordManager recordManager,DepartmentInfoGet departmentInfoGet) {
494
-
495
- this.recordManager = recordManager;
496
-
497
- this.departmentInfoGet = departmentInfoGet;
498
-
499
- }
500
-
501
-
502
-
503
- @RequestMapping(value = "/start")
504
-
505
- public String init(AddressBookForm form, Model model) {
506
-
507
- model.addAttribute("message", INIMSG);
508
-
509
- return INIT;
510
-
511
- }
512
-
513
-
514
-
515
- @RequestMapping(params = "reference") //参照
516
-
517
- public String refer(@Valid AddressBookForm form, BindingResult result, Model model) {
518
-
519
- if (result.hasErrors()) {
520
-
521
- System.out.println("aaa");
522
-
523
- return INIT;
524
-
525
- }
526
-
527
-
528
-
529
- List<Map<String, Object>> departmentList = departmentInfoGet.getDepartmentList();
530
-
531
- model.addAttribute("departmentList", departmentList);
532
-
533
-
534
-
535
- Employee employee = recordManager.selectEmployee(form.getId());
536
-
537
- if (employee != null) {
538
-
539
- form.setName(employee.getName());
540
-
541
- form.setPhone(employee.getPhone());
542
-
543
- form.setAddress(employee.getAddress());
544
-
545
- form.setKana(employee.getKana());
546
-
547
- form.setSex(employee.getSex());
548
-
549
- form.setDepartment(employee.getDepartment());
550
-
551
- model.addAttribute("message", REFMSG);
552
-
553
- return REFER;
554
-
555
- } else {
556
-
557
- model.addAttribute("message", ERRMSG);
558
-
559
- return INIT;
560
-
561
- }
562
-
563
- }
564
-
565
-
566
-
567
- @RequestMapping(params = "list") //一覧
568
-
569
- public String list(Model model) {
570
-
571
- List<Map<String, Object>> employeeList = recordManager.getEmployeeList();
572
-
573
- model.addAttribute("employeeList", employeeList);
574
-
575
- model.addAttribute("employeeCount", employeeList.size());
576
-
577
- return LIST;
578
-
579
- }
437
+ (修正前のlog4j.xml)
438
+
439
+ <?xml version="1.0" encoding="UTF-8"?>
440
+
441
+ <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
442
+
443
+ <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
444
+
445
+
446
+
447
+ <!-- Appenders -->
448
+
449
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
450
+
451
+ <param name="Target" value="System.out" />
452
+
453
+ <layout class="org.apache.log4j.PatternLayout">
454
+
455
+ <param name="ConversionPattern" value="%-5p: %c - %m%n" />
456
+
457
+ </layout>
458
+
459
+ </appender>
460
+
461
+
462
+
463
+ <!-- Application Loggers -->
464
+
465
+ <logger name="jp.practice.address">
466
+
467
+ <level value="info" />
468
+
469
+ </logger>
470
+
471
+
472
+
473
+ <!-- 3rdparty Loggers -->
474
+
475
+ <logger name="org.springframework.core">
476
+
477
+ <level value="info" />
478
+
479
+ </logger>
480
+
481
+
482
+
483
+ <logger name="org.springframework.beans">
484
+
485
+ <level value="info" />
486
+
487
+ </logger>
488
+
489
+
490
+
491
+ <logger name="org.springframework.context">
492
+
493
+ <level value="info" />
494
+
495
+ </logger>
496
+
497
+
498
+
499
+ <logger name="org.springframework.web">
500
+
501
+ <level value="info" />
502
+
503
+ </logger>
504
+
505
+
506
+
507
+ <!-- Root Logger -->
508
+
509
+ <root>
510
+
511
+ <priority value="warn" />
512
+
513
+ <appender-ref ref="console" />
514
+
515
+ </root>
516
+
517
+ </log4j:configuration>
518
+
519
+
580
520
 
581
521
  ```
582
522
 

4

追記

2019/10/01 01:49

投稿

usako
usako

スコア31

test CHANGED
File without changes
test CHANGED
@@ -432,6 +432,8 @@
432
432
 
433
433
  ```
434
434
 
435
+ ■9月27日追記
436
+
435
437
  ```
436
438
 
437
439
  (Addressbook.java)

3

記載追加

2019/09/27 00:47

投稿

usako
usako

スコア31

test CHANGED
File without changes
test CHANGED
@@ -432,6 +432,154 @@
432
432
 
433
433
  ```
434
434
 
435
+ ```
436
+
437
+ (Addressbook.java)
438
+
439
+ package jp.practice.address;
440
+
441
+
442
+
443
+ import java.util.List;
444
+
445
+ import java.util.Map;
446
+
447
+
448
+
449
+ import javax.validation.Valid;
450
+
451
+
452
+
453
+ import org.springframework.stereotype.Controller;
454
+
455
+ import org.springframework.ui.Model;
456
+
457
+ import org.springframework.validation.BindingResult;
458
+
459
+ import org.springframework.web.bind.annotation.RequestMapping;
460
+
461
+
462
+
463
+ @Controller
464
+
465
+ @RequestMapping(value = "/book")
466
+
467
+ public class AddressBookController {
468
+
469
+ private static final String INIT = "init";
470
+
471
+ private static final String REFER = "refer";
472
+
473
+ private static final String UPDATE = "update";
474
+
475
+ private static final String LIST = "list";
476
+
477
+ private static final String INIMSG = "従業員番号を入力してください";
478
+
479
+ private static final String REFMSG = "情報が取得できました";
480
+
481
+ private static final String UPDMSG = "情報を更新してください";
482
+
483
+ private static final String ERRMSG = "該当するデータはありません";
484
+
485
+ private RecordManager recordManager;
486
+
487
+
488
+
489
+ private DepartmentInfoGet departmentInfoGet;
490
+
491
+ public AddressBookController(RecordManager recordManager,DepartmentInfoGet departmentInfoGet) {
492
+
493
+ this.recordManager = recordManager;
494
+
495
+ this.departmentInfoGet = departmentInfoGet;
496
+
497
+ }
498
+
499
+
500
+
501
+ @RequestMapping(value = "/start")
502
+
503
+ public String init(AddressBookForm form, Model model) {
504
+
505
+ model.addAttribute("message", INIMSG);
506
+
507
+ return INIT;
508
+
509
+ }
510
+
511
+
512
+
513
+ @RequestMapping(params = "reference") //参照
514
+
515
+ public String refer(@Valid AddressBookForm form, BindingResult result, Model model) {
516
+
517
+ if (result.hasErrors()) {
518
+
519
+ System.out.println("aaa");
520
+
521
+ return INIT;
522
+
523
+ }
524
+
525
+
526
+
527
+ List<Map<String, Object>> departmentList = departmentInfoGet.getDepartmentList();
528
+
529
+ model.addAttribute("departmentList", departmentList);
530
+
531
+
532
+
533
+ Employee employee = recordManager.selectEmployee(form.getId());
534
+
535
+ if (employee != null) {
536
+
537
+ form.setName(employee.getName());
538
+
539
+ form.setPhone(employee.getPhone());
540
+
541
+ form.setAddress(employee.getAddress());
542
+
543
+ form.setKana(employee.getKana());
544
+
545
+ form.setSex(employee.getSex());
546
+
547
+ form.setDepartment(employee.getDepartment());
548
+
549
+ model.addAttribute("message", REFMSG);
550
+
551
+ return REFER;
552
+
553
+ } else {
554
+
555
+ model.addAttribute("message", ERRMSG);
556
+
557
+ return INIT;
558
+
559
+ }
560
+
561
+ }
562
+
563
+
564
+
565
+ @RequestMapping(params = "list") //一覧
566
+
567
+ public String list(Model model) {
568
+
569
+ List<Map<String, Object>> employeeList = recordManager.getEmployeeList();
570
+
571
+ model.addAttribute("employeeList", employeeList);
572
+
573
+ model.addAttribute("employeeCount", employeeList.size());
574
+
575
+ return LIST;
576
+
577
+ }
578
+
579
+ ```
580
+
581
+
582
+
435
583
  ### 試したこと
436
584
 
437
585
  ・sevlet-contectの<beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />

2

9/20 追記

2019/09/27 00:46

投稿

usako
usako

スコア31

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,9 @@
26
26
 
27
27
  ### 該当のソースコード
28
28
 
29
+ ```
30
+
29
- ```sevlet-context
31
+ (sevlet-context)
30
32
 
31
33
 
32
34
 
@@ -46,7 +48,7 @@
46
48
 
47
49
  <beans:property name="username" value="root" />
48
50
 
49
- <beans:property name="password" value="mippy333" />
51
+ <beans:property name="password" value="xxxxxxxx" />
50
52
 
51
53
  </beans:bean>
52
54
 
@@ -62,6 +64,374 @@
62
64
 
63
65
  ```
64
66
 
67
+ ```
68
+
69
+ (pom.xml)
70
+
71
+ <?xml version="1.0" encoding="UTF-8"?>
72
+
73
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
74
+
75
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
76
+
77
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
78
+
79
+ <modelVersion>4.0.0</modelVersion>
80
+
81
+ <groupId>jp.practice</groupId>
82
+
83
+ <artifactId>address</artifactId>
84
+
85
+ <name>unit03</name>
86
+
87
+ <packaging>war</packaging>
88
+
89
+ <version>1.0.0-BUILD-SNAPSHOT</version>
90
+
91
+ <properties>
92
+
93
+ <java-version>1.8</java-version>
94
+
95
+ <org.springframework-version>4.3.7.RELEASE
96
+
97
+ </org.springframework-version>
98
+
99
+ <org.aspectj-version>1.6.10</org.aspectj-version>
100
+
101
+ <org.slf4j-version>1.6.6</org.slf4j-version>
102
+
103
+ </properties>
104
+
105
+ <dependencies>
106
+
107
+ <dependency>
108
+
109
+ <groupId>org.hibernate</groupId>
110
+
111
+ <artifactId>hibernate-validator</artifactId>
112
+
113
+ <version>5.1.0.Final</version>
114
+
115
+ </dependency>
116
+
117
+ <!-- Spring -->
118
+
119
+ <dependency>
120
+
121
+ <groupId>org.springframework</groupId>
122
+
123
+ <artifactId>spring-context</artifactId>
124
+
125
+ <version>${org.springframework-version}</version>
126
+
127
+ <exclusions>
128
+
129
+ <!-- Exclude Commons Logging in favor of SLF4j -->
130
+
131
+ <exclusion>
132
+
133
+ <groupId>commons-logging</groupId>
134
+
135
+ <artifactId>commons-logging</artifactId>
136
+
137
+ </exclusion>
138
+
139
+ </exclusions>
140
+
141
+ </dependency>
142
+
143
+ <dependency>
144
+
145
+ <groupId>org.springframework</groupId>
146
+
147
+ <artifactId>spring-webmvc</artifactId>
148
+
149
+ <version>${org.springframework-version}</version>
150
+
151
+ </dependency>
152
+
153
+
154
+
155
+ <!-- add -->
156
+
157
+ <dependency>
158
+
159
+ <groupId>org.springframework</groupId>
160
+
161
+ <artifactId>spring-jdbc</artifactId>
162
+
163
+ <version>4.2.3.RELEASE</version>
164
+
165
+ </dependency>
166
+
167
+
168
+
169
+ <dependency>
170
+
171
+ <groupId>mysql</groupId>
172
+
173
+ <artifactId>mysql-connector-java</artifactId>
174
+
175
+ <version>5.1.45</version>
176
+
177
+ </dependency>
178
+
179
+ <!-- add -->
180
+
181
+
182
+
183
+ <!-- AspectJ -->
184
+
185
+ <dependency>
186
+
187
+ <groupId>org.aspectj</groupId>
188
+
189
+ <artifactId>aspectjrt</artifactId>
190
+
191
+ <version>${org.aspectj-version}</version>
192
+
193
+ </dependency>
194
+
195
+
196
+
197
+ <!-- Logging -->
198
+
199
+ <dependency>
200
+
201
+ <groupId>org.slf4j</groupId>
202
+
203
+ <artifactId>slf4j-api</artifactId>
204
+
205
+ <version>${org.slf4j-version}</version>
206
+
207
+ </dependency>
208
+
209
+ <dependency>
210
+
211
+ <groupId>org.slf4j</groupId>
212
+
213
+ <artifactId>jcl-over-slf4j</artifactId>
214
+
215
+ <version>${org.slf4j-version}</version>
216
+
217
+ <scope>runtime</scope>
218
+
219
+ </dependency>
220
+
221
+ <dependency>
222
+
223
+ <groupId>org.slf4j</groupId>
224
+
225
+ <artifactId>slf4j-log4j12</artifactId>
226
+
227
+ <version>${org.slf4j-version}</version>
228
+
229
+ <scope>runtime</scope>
230
+
231
+ </dependency>
232
+
233
+ <dependency>
234
+
235
+ <groupId>log4j</groupId>
236
+
237
+ <artifactId>log4j</artifactId>
238
+
239
+ <version>1.2.15</version>
240
+
241
+ <exclusions>
242
+
243
+ <exclusion>
244
+
245
+ <groupId>javax.mail</groupId>
246
+
247
+ <artifactId>mail</artifactId>
248
+
249
+ </exclusion>
250
+
251
+ <exclusion>
252
+
253
+ <groupId>javax.jms</groupId>
254
+
255
+ <artifactId>jms</artifactId>
256
+
257
+ </exclusion>
258
+
259
+ <exclusion>
260
+
261
+ <groupId>com.sun.jdmk</groupId>
262
+
263
+ <artifactId>jmxtools</artifactId>
264
+
265
+ </exclusion>
266
+
267
+ <exclusion>
268
+
269
+ <groupId>com.sun.jmx</groupId>
270
+
271
+ <artifactId>jmxri</artifactId>
272
+
273
+ </exclusion>
274
+
275
+ </exclusions>
276
+
277
+ <scope>runtime</scope>
278
+
279
+ </dependency>
280
+
281
+
282
+
283
+ <!-- @Inject -->
284
+
285
+ <dependency>
286
+
287
+ <groupId>javax.inject</groupId>
288
+
289
+ <artifactId>javax.inject</artifactId>
290
+
291
+ <version>1</version>
292
+
293
+ </dependency>
294
+
295
+
296
+
297
+ <!-- Servlet -->
298
+
299
+ <dependency>
300
+
301
+ <groupId>javax.servlet</groupId>
302
+
303
+ <artifactId>servlet-api</artifactId>
304
+
305
+ <version>2.5</version>
306
+
307
+ <scope>provided</scope>
308
+
309
+ </dependency>
310
+
311
+ <dependency>
312
+
313
+ <groupId>javax.servlet.jsp</groupId>
314
+
315
+ <artifactId>jsp-api</artifactId>
316
+
317
+ <version>2.1</version>
318
+
319
+ <scope>provided</scope>
320
+
321
+ </dependency>
322
+
323
+ <dependency>
324
+
325
+ <groupId>javax.servlet</groupId>
326
+
327
+ <artifactId>jstl</artifactId>
328
+
329
+ <version>1.2</version>
330
+
331
+ </dependency>
332
+
333
+
334
+
335
+ <!-- Test -->
336
+
337
+ <dependency>
338
+
339
+ <groupId>junit</groupId>
340
+
341
+ <artifactId>junit</artifactId>
342
+
343
+ <version>4.7</version>
344
+
345
+ <scope>test</scope>
346
+
347
+ </dependency>
348
+
349
+ </dependencies>
350
+
351
+ <build>
352
+
353
+ <plugins>
354
+
355
+ <plugin>
356
+
357
+ <artifactId>maven-eclipse-plugin</artifactId>
358
+
359
+ <version>2.9</version>
360
+
361
+ <configuration>
362
+
363
+ <additionalProjectnatures>
364
+
365
+ <projectnature>org.springframework.ide.eclipse.core.springnature
366
+
367
+ </projectnature>
368
+
369
+ </additionalProjectnatures>
370
+
371
+ <additionalBuildcommands>
372
+
373
+ <buildcommand>org.springframework.ide.eclipse.core.springbuilder
374
+
375
+ </buildcommand>
376
+
377
+ </additionalBuildcommands>
378
+
379
+ <downloadSources>true</downloadSources>
380
+
381
+ <downloadJavadocs>true</downloadJavadocs>
382
+
383
+ </configuration>
384
+
385
+ </plugin>
386
+
387
+ <plugin>
388
+
389
+ <groupId>org.apache.maven.plugins</groupId>
390
+
391
+ <artifactId>maven-compiler-plugin</artifactId>
392
+
393
+ <version>2.5.1</version>
394
+
395
+ <configuration>
396
+
397
+ <source>1.8</source>
398
+
399
+ <target>1.8</target>
400
+
401
+ <compilerArgument>-Xlint:all</compilerArgument>
402
+
403
+ <showWarnings>true</showWarnings>
404
+
405
+ <showDeprecation>true</showDeprecation>
406
+
407
+ </configuration>
408
+
409
+ </plugin>
410
+
411
+ <plugin>
412
+
413
+ <groupId>org.codehaus.mojo</groupId>
414
+
415
+ <artifactId>exec-maven-plugin</artifactId>
416
+
417
+ <version>1.2.1</version>
418
+
419
+ <configuration>
420
+
421
+ <mainClass>org.test.int1.Main</mainClass>
422
+
423
+ </configuration>
424
+
425
+ </plugin>
426
+
427
+ </plugins>
428
+
429
+ </build>
430
+
431
+ </project>
432
+
433
+ ```
434
+
65
435
  ### 試したこと
66
436
 
67
437
  ・sevlet-contectの<beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />
@@ -72,4 +442,8 @@
72
442
 
73
443
  MySql:ver.8.0.16
74
444
 
445
+ (確認方法:コマンドプロンプトでmysql --versionと入力実行)
446
+
75
447
  Connector/J:ver.8.0.17
448
+
449
+ (確認方法:ユーザ変数PATHにC:\Program Files\MySQL\MySQL Shell 8.0\bin;が記載されており、その配下にmysql-connector-java-8.0.17.jarが存在する)

1

不要な文字を修正

2019/09/20 05:19

投稿

usako
usako

スコア31

test CHANGED
File without changes
test CHANGED
@@ -62,12 +62,6 @@
62
62
 
63
63
  ```
64
64
 
65
- ```java
66
-
67
- コード
68
-
69
- ```
70
-
71
65
  ### 試したこと
72
66
 
73
67
  ・sevlet-contectの<beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />