質問編集履歴

1

ご指摘いただいた通り、マークダウンを使い、ファイルごとに細分化し、エラーログも記載しました。よろしくお願い致します。(文字制限に引っかかったため、いらない部分は一部省略しています)

2021/09/29 13:15

投稿

mario11222
mario11222

スコア4

test CHANGED
File without changes
test CHANGED
@@ -24,17 +24,9 @@
24
24
 
25
25
 
26
26
 
27
- ### 発生している問題・エラーメッセージ
28
-
29
- デバックでDAOの「pStmt1.setString(3,encryption.seacret(ab.getPass()));」
30
-
31
- にカーソルを合わせた際にでたメッセージがcom.mysql.cj.jdbc.ClientPreparedStatement: INSERT INTO ACCOUNT(NAME,MAIL,PASS) VALUES('湊 一郎','ichirou@gmail.com',** NOT SPECIFIED **)→NOT SPECIFIEDが問題だと思ってます。
32
-
33
-
34
-
35
27
  ### 該当のソースコード
36
28
 
37
- JavaBeans
29
+ ```JavaBeans
38
30
 
39
31
  package model;
40
32
 
@@ -120,7 +112,9 @@
120
112
 
121
113
  }
122
114
 
123
-
115
+ ```
116
+
117
+ ```Java
124
118
 
125
119
  暗号化のメソッド
126
120
 
@@ -128,20 +122,6 @@
128
122
 
129
123
 
130
124
 
131
- import java.nio.charset.Charset;
132
-
133
- import java.nio.charset.StandardCharsets;
134
-
135
- import java.security.MessageDigest;
136
-
137
- import java.security.NoSuchAlgorithmException;
138
-
139
-
140
-
141
- import javax.xml.bind.DatatypeConverter;
142
-
143
-
144
-
145
125
  public class Encryption {
146
126
 
147
127
 
@@ -188,32 +168,14 @@
188
168
 
189
169
 
190
170
 
191
-
171
+ ```
192
-
172
+
193
- DAO
173
+ ```DAO
194
174
 
195
175
  package dao;
196
176
 
197
177
 
198
178
 
199
- import java.sql.Connection;
200
-
201
- import java.sql.DriverManager;
202
-
203
- import java.sql.PreparedStatement;
204
-
205
- import java.sql.ResultSet;
206
-
207
- import java.sql.SQLException;
208
-
209
-
210
-
211
- import model.Encryption;
212
-
213
- import model.User;
214
-
215
-
216
-
217
179
  public class RegisterDAO {
218
180
 
219
181
 
@@ -364,42 +326,14 @@
364
326
 
365
327
  }
366
328
 
367
-
329
+ ```
368
-
330
+
369
- サーブレット
331
+ ```サーブレット
370
332
 
371
333
  package servlet;
372
334
 
373
335
 
374
336
 
375
- import java.io.IOException;
376
-
377
-
378
-
379
- import javax.servlet.RequestDispatcher;
380
-
381
- import javax.servlet.ServletException;
382
-
383
- import javax.servlet.annotation.WebServlet;
384
-
385
- import javax.servlet.http.HttpServlet;
386
-
387
- import javax.servlet.http.HttpServletRequest;
388
-
389
- import javax.servlet.http.HttpServletResponse;
390
-
391
- import javax.servlet.http.HttpSession;
392
-
393
-
394
-
395
- import dao.RegisterDAO;
396
-
397
- import model.Encryption;
398
-
399
- import model.User;
400
-
401
-
402
-
403
337
  /**
404
338
 
405
339
  * Servlet implementation class Register
@@ -514,9 +448,9 @@
514
448
 
515
449
  }
516
450
 
517
-
451
+ ```
518
-
452
+
519
- jsp
453
+ ```jsp
520
454
 
521
455
  <%@ page language="java" contentType="text/html; charset=UTF-8"
522
456
 
@@ -538,70 +472,6 @@
538
472
 
539
473
  <body>
540
474
 
541
- <script type="text/javascript">
542
-
543
- window.onload = function(){
544
-
545
- const btnSubmit = document.getElementById("btnSubmit");
546
-
547
- const inputName = document.getElementById("inputName");
548
-
549
- const inputMail = document.getElementById("inputMail");
550
-
551
- const reg = /^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}.[A-Za-z0-9]{1,}$/;
552
-
553
-
554
-
555
- btnSubmit.addEventListener("click",function(event){
556
-
557
- let message = [];
558
-
559
- /*入力値チェック*/
560
-
561
- if(inputName.value == ""){
562
-
563
- message.push("氏名が未入力です。");
564
-
565
-
566
-
567
- }
568
-
569
- if(inputMail.value == ""){
570
-
571
- message.push("メールアドレスが未入力です。")
572
-
573
-
574
-
575
- }else if(!reg.test(inputMail.value)){
576
-
577
- message.push("メールアドレスの形式が不正です");
578
-
579
-
580
-
581
- }
582
-
583
- if(message.length > 0){
584
-
585
- alert(message);
586
-
587
- event.preventDefault();
588
-
589
- return;
590
-
591
- }
592
-
593
- alert("入力チェックOK");
594
-
595
- });
596
-
597
-
598
-
599
- };
600
-
601
-
602
-
603
- </script>
604
-
605
475
  <h1>ユーザー登録画面</h1>
606
476
 
607
477
  <div id = "message">
@@ -624,7 +494,73 @@
624
494
 
625
495
  </html>
626
496
 
627
-
497
+ ```
498
+
499
+ ```log
500
+
501
+ com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column 'pass' at row 1
502
+
503
+ at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:104)
504
+
505
+ at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
506
+
507
+ at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1092)
508
+
509
+ at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1040)
510
+
511
+ at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1347)
512
+
513
+ at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1025)
514
+
515
+ at dao.RegisterDAO.AccountRegister(RegisterDAO.java:50)
516
+
517
+ at servlet.Register.doPost(Register.java:56)
518
+
519
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
520
+
521
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
522
+
523
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
524
+
525
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
526
+
527
+ at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
528
+
529
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
530
+
531
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
532
+
533
+ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
534
+
535
+ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
536
+
537
+ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
538
+
539
+ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
540
+
541
+ at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
542
+
543
+ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
544
+
545
+ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
546
+
547
+ at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
548
+
549
+ at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
550
+
551
+ at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
552
+
553
+ at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
554
+
555
+ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
556
+
557
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
558
+
559
+ at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
560
+
561
+ at java.lang.Thread.run(Thread.java:748)
562
+
563
+ ```
628
564
 
629
565
  ### 試したこと
630
566