質問編集履歴
1
コードを修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,19 +4,58 @@
|
|
4
4
|
|
5
5
|
エラー:ArrayList を型に解決できませんと表示されます。
|
6
6
|
なぜ、ArrayListを型に解決できないのでしょうか。
|
7
|
+
→pageディレクティブを改善したら、エラーが取れました。
|
8
|
+
しかし、今度はGyomuが解決できません。と出ます。
|
9
|
+
エラー:JSPファイル: [/WEB-INF/ListScreen.jsp] の中の[18]行目でエラーが発生しました
|
10
|
+
エラー:JSPファイル: [/WEB-INF/ListScreen.jsp] の中の[22]行目でエラーが発生しました
|
7
11
|
|
12
|
+
|
8
13
|
```java
|
9
|
-
|
14
|
+
package servlet;
|
10
|
-
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
11
|
-
pageEncoding="UTF-8"
|
12
|
-
page import="java.util.ArrayList"
|
13
|
-
page import="java.util.ArrayList"
|
14
15
|
|
15
|
-
page language="java" contentType="text/html; charset=Windows-31J"
|
16
|
-
|
16
|
+
import java.io.IOException;
|
17
|
-
|
17
|
+
import java.util.List;
|
18
18
|
|
19
|
+
import javax.servlet.RequestDispatcher;
|
20
|
+
import javax.servlet.ServletException;
|
21
|
+
import javax.servlet.annotation.WebServlet;
|
22
|
+
import javax.servlet.http.HttpServlet;
|
23
|
+
import javax.servlet.http.HttpServletRequest;
|
24
|
+
import javax.servlet.http.HttpServletResponse;
|
19
25
|
|
26
|
+
import model.GetGyomuhokokuListLogic;
|
27
|
+
import model.Gyomu;
|
28
|
+
|
29
|
+
@WebServlet("/ListScreen")
|
30
|
+
public class ListScreen extends HttpServlet {
|
31
|
+
private static final long serialVersionUID = 1L;
|
32
|
+
|
33
|
+
protected void doPost(HttpServletRequest request,
|
34
|
+
HttpServletResponse response)
|
35
|
+
throws ServletException, IOException {
|
36
|
+
|
37
|
+
GetGyomuhokokuListLogic getGyomuhokokuListLogic = new GetGyomuhokokuListLogic();
|
38
|
+
List<Gyomu> gyomuList = getGyomuhokokuListLogic.execute();
|
39
|
+
|
40
|
+
|
41
|
+
request.setAttribute("gyomuList", gyomuList);
|
42
|
+
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/ListScreen.jsp");
|
43
|
+
dispatcher.forward(request, response);
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
```
|
51
|
+
|
52
|
+
```java
|
53
|
+
|
54
|
+
ListScreen.jsp
|
55
|
+
<%@ page language="java"
|
56
|
+
contentType="text/html; charset=UTF-8"
|
57
|
+
pageEncoding="UTF-8"
|
58
|
+
import="java.util.ArrayList"
|
20
59
|
%>
|
21
60
|
|
22
61
|
<html>
|
@@ -65,44 +104,5 @@
|
|
65
104
|
|
66
105
|
</body>
|
67
106
|
</html>
|
68
|
-
```
|
69
107
|
|
70
|
-
```java
|
71
|
-
|
72
|
-
ListScreen.jsp
|
73
|
-
package servlet;
|
74
|
-
|
75
|
-
import java.io.IOException;
|
76
|
-
import java.util.List;
|
77
|
-
|
78
|
-
import javax.servlet.RequestDispatcher;
|
79
|
-
import javax.servlet.ServletException;
|
80
|
-
import javax.servlet.annotation.WebServlet;
|
81
|
-
import javax.servlet.http.HttpServlet;
|
82
|
-
import javax.servlet.http.HttpServletRequest;
|
83
|
-
import javax.servlet.http.HttpServletResponse;
|
84
|
-
|
85
|
-
import model.GetGyomuhokokuListLogic;
|
86
|
-
import model.Gyomu;
|
87
|
-
|
88
|
-
@WebServlet("/ListScreen")
|
89
|
-
public class ListScreen extends HttpServlet {
|
90
|
-
private static final long serialVersionUID = 1L;
|
91
|
-
|
92
|
-
protected void doGet(HttpServletRequest request,
|
93
|
-
HttpServletResponse response)
|
94
|
-
throws ServletException, IOException {
|
95
|
-
|
96
|
-
GetGyomuhokokuListLogic getGyomuhokokuListLogic = new GetGyomuhokokuListLogic();
|
97
|
-
List<Gyomu> gyomuList = getGyomuhokokuListLogic.execute();
|
98
|
-
|
99
|
-
|
100
|
-
request.setAttribute("gyomuList", gyomuList);
|
101
|
-
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/Login.jsp");
|
102
|
-
dispatcher.forward(request, response);
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
}
|
107
|
-
}
|
108
108
|
```
|