質問編集履歴
2
間違えてるところを直しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
</head>
|
51
51
|
<body>
|
52
52
|
<h1>input</h1>
|
53
|
-
<form action="
|
53
|
+
<form action="test" method="post">
|
54
54
|
<input type="text" name="name" value=""/>
|
55
55
|
<input type="submit" value="send"/>
|
56
56
|
</form>
|
@@ -77,7 +77,7 @@
|
|
77
77
|
/**
|
78
78
|
* Servlet implementation class Test
|
79
79
|
*/
|
80
|
-
@WebServlet("/
|
80
|
+
@WebServlet("/test")
|
81
81
|
public class Test extends HttpServlet {
|
82
82
|
private static final long serialVersionUID = 1L;
|
83
83
|
|
1
ArrayListに統一しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
<hr/>
|
21
21
|
<a href="input.jsp">Link</a>
|
22
22
|
|
23
|
-
<%
|
23
|
+
<% ArrayList<String> arrayName = new ArrayList<String>();
|
24
24
|
arrayName = (ArrayList<String>)request.getAttribute("name");
|
25
25
|
if(arrayName != null && !arrayName.isEmpty()){
|
26
26
|
for(int index = 0; index < arrayName.size(); index++){
|
@@ -62,10 +62,10 @@
|
|
62
62
|
Test.java(input.jspで入力したテキストを受け取りnameに格納します)
|
63
63
|
```Servlet
|
64
64
|
package zTest;
|
65
|
+
package zTest;
|
65
66
|
|
66
67
|
import java.io.IOException;
|
67
68
|
import java.util.ArrayList;
|
68
|
-
import java.util.List;
|
69
69
|
|
70
70
|
import javax.servlet.RequestDispatcher;
|
71
71
|
import javax.servlet.ServletException;
|
@@ -81,7 +81,7 @@
|
|
81
81
|
public class Test extends HttpServlet {
|
82
82
|
private static final long serialVersionUID = 1L;
|
83
83
|
|
84
|
-
|
84
|
+
ArrayList<String> name = new ArrayList<String>();
|
85
85
|
|
86
86
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
87
87
|
request.setCharacterEncoding("UTF-8");
|