質問編集履歴
1
問題解決後に編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,6 +28,8 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
+
↓問題解決後に編集
|
32
|
+
|
31
33
|
```java
|
32
34
|
|
33
35
|
package com.koikeya.project1.app.controller;
|
@@ -54,6 +56,8 @@
|
|
54
56
|
|
55
57
|
import org.springframework.web.bind.annotation.RequestParam;
|
56
58
|
|
59
|
+
import org.springframework.web.bind.annotation.ResponseBody;
|
60
|
+
|
57
61
|
|
58
62
|
|
59
63
|
import com.koikeya.project1.app.form.UserForm;
|
@@ -132,9 +136,13 @@
|
|
132
136
|
|
133
137
|
@RequestMapping("registered_check")
|
134
138
|
|
139
|
+
@ResponseBody
|
140
|
+
|
135
|
-
boolean registeredCheck(@RequestParam("
|
141
|
+
boolean registeredCheck(@RequestParam("emailAddress") String emailAddress) {
|
142
|
+
|
136
|
-
|
143
|
+
logger.info("成功");
|
144
|
+
|
137
|
-
user.setEmailAddress(
|
145
|
+
user.setEmailAddress(emailAddress);
|
138
146
|
|
139
147
|
return registeredCheck.registeredCheck(user);
|
140
148
|
|
@@ -384,56 +392,80 @@
|
|
384
392
|
|
385
393
|
```
|
386
394
|
|
387
|
-
|
395
|
+
↓問題解決後に編集
|
388
396
|
|
389
397
|
```javascript
|
390
398
|
|
399
|
+
'use strict';
|
400
|
+
|
401
|
+
window.onload = function() {
|
402
|
+
|
391
|
-
var submt = document.getElementById('submit');
|
403
|
+
var submit = document.getElementById('submit');
|
392
|
-
|
404
|
+
|
405
|
+
|
406
|
+
|
393
|
-
console.log(submit);
|
407
|
+
console.log(submit);
|
408
|
+
|
394
|
-
|
409
|
+
if (submit == null) {
|
410
|
+
|
395
|
-
|
411
|
+
submit = document.getElementById('submit');
|
412
|
+
|
396
|
-
|
413
|
+
}
|
414
|
+
|
415
|
+
console.log(submit);
|
416
|
+
|
397
|
-
submit.addEventListener('click', () => {
|
417
|
+
submit.addEventListener('click', () => {
|
398
|
-
|
418
|
+
|
399
|
-
var inputEmailAddress = document.getElementById('inputEmailAddress').value;
|
419
|
+
var inputEmailAddress = document.getElementById('inputEmailAddress').value;
|
400
|
-
|
420
|
+
|
401
|
-
var inputEmailAddressConfirm = document.getElementById('inputEmailAddressConfirm').value;
|
421
|
+
var inputEmailAddressConfirm = document.getElementById('inputEmailAddressConfirm').value;
|
402
|
-
|
422
|
+
|
403
|
-
var inputPassword = document.getElementById('inputPassword').value;
|
423
|
+
var inputPassword = document.getElementById('inputPassword').value;
|
404
|
-
|
424
|
+
|
405
|
-
var inputPasswordConfirm = document.getElementById('inputPasswordConfirm').value;
|
425
|
+
var inputPasswordConfirm = document.getElementById('inputPasswordConfirm').value;
|
406
|
-
|
426
|
+
|
407
|
-
console.log(
|
427
|
+
console.log('デバッグ中2');
|
408
|
-
|
409
|
-
|
410
|
-
|
428
|
+
|
429
|
+
|
430
|
+
|
411
|
-
if (inputEmailAddress != inputEmailAddressConfirm) {
|
431
|
+
if (inputEmailAddress != inputEmailAddressConfirm) {
|
412
|
-
|
432
|
+
|
413
|
-
event.preventDefault();
|
433
|
+
event.preventDefault();
|
414
|
-
|
434
|
+
|
415
|
-
alert(
|
435
|
+
alert('メールアドレスが一致しません。');
|
416
|
-
|
436
|
+
|
417
|
-
} else if (inputPassword != inputPasswordConfirm) {
|
437
|
+
} else if (inputPassword != inputPasswordConfirm) {
|
418
|
-
|
438
|
+
|
419
|
-
event.preventDefault();
|
439
|
+
event.preventDefault();
|
420
|
-
|
440
|
+
|
421
|
-
alert(
|
441
|
+
alert('パスワードが一致しません。');
|
422
|
-
|
442
|
+
|
423
|
-
|
443
|
+
}
|
424
444
|
|
425
445
|
var request = new XMLHttpRequest();
|
426
446
|
|
427
|
-
request.open('GET', 'http://localhost:8080/project1/registered_check'
|
447
|
+
request.open('GET', 'http://localhost:8080/project1/registered_check?emailAddress=' + inputEmailAddress, false);
|
428
|
-
|
448
|
+
|
429
|
-
|
449
|
+
console.log(inputEmailAddress)
|
450
|
+
|
451
|
+
if (request.responseText === 'true') {
|
452
|
+
|
453
|
+
event.preventDefault();
|
454
|
+
|
455
|
+
alert('メールアドレスが登録されているため登録できません。');
|
456
|
+
|
457
|
+
}
|
430
458
|
|
431
459
|
console.log(request.responseText);
|
432
460
|
|
433
|
-
// // TODO サーバーからのレスポンスでメールアドレスが登録済みだったらポップアップを表示して、画面遷移を中止
|
461
|
+
// // TODO サーバーからのレスポンスでメールアドレスが登録済みだったらポップアップを表示して、画面遷移を中止
|
434
|
-
|
435
|
-
|
462
|
+
|
436
|
-
|
437
|
-
})
|
463
|
+
})}
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
438
470
|
|
439
471
|
```
|