質問編集履歴
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,228 +14,216 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
+
|
18
|
+
|
19
|
+
1.Google Chromeブラウザから.PickUp.javaにリクエストすると
|
20
|
+
|
21
|
+
「宛先別配達商品リスト発行画面」が表示されるが,セレクトボックスは空です。
|
22
|
+
|
23
|
+
2.Eclipse上で直接top.jpsを実行するとエラーメッセージが出ます。
|
24
|
+
|
25
|
+
HTTPステータス404-見つかりません
|
26
|
+
|
17
|
-
|
27
|
+
タイプ ステータスレポート
|
28
|
+
|
29
|
+
オリジン オリジンサーバーはターゲットソースの現在の表現を見つけられなかったかまたはそれが存在することを開示す るつもりはありません。
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
### 該当のソースコード
|
38
|
+
|
39
|
+
```java
|
40
|
+
|
41
|
+
package servlet;
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
import java.io.IOException;
|
46
|
+
|
47
|
+
import java.util.Arrays;
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
import javax.servlet.RequestDispatcher;
|
52
|
+
|
53
|
+
import javax.servlet.ServletException;
|
54
|
+
|
55
|
+
import javax.servlet.annotation.WebServlet;
|
56
|
+
|
57
|
+
import javax.servlet.http.HttpServlet;
|
58
|
+
|
59
|
+
import javax.servlet.http.HttpServletRequest;
|
60
|
+
|
61
|
+
import javax.servlet.http.HttpServletResponse;
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
import model.Branch;
|
66
|
+
|
67
|
+
import model.BranchGet;
|
68
|
+
|
69
|
+
import model.DataPrintable;
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
@WebServlet("/PickUp")
|
76
|
+
|
77
|
+
public class PickUp extends HttpServlet {
|
78
|
+
|
79
|
+
private static final long serialVersionUID = 1L;
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
public PickUp() {
|
86
|
+
|
87
|
+
super();
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
98
|
+
|
99
|
+
String[] branchw;
|
100
|
+
|
101
|
+
BranchGet bg = new BranchGet();
|
102
|
+
|
103
|
+
Branch branch = new Branch();
|
104
|
+
|
105
|
+
branchw=bg.execute();
|
106
|
+
|
107
|
+
branch.setBranch(branchw);
|
108
|
+
|
109
|
+
System.out.println("PickUp="+Arrays.toString(branchw));
|
110
|
+
|
111
|
+
request.setAttribute("branch",branch);
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/jsp/top.jsp");
|
116
|
+
|
117
|
+
dispatcher.forward(request, response);
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
@SuppressWarnings("static-access")
|
126
|
+
|
127
|
+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
DataPrintable dp =new DataPrintable();
|
132
|
+
|
133
|
+
dp.main();
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/jsp/result.jsp");
|
138
|
+
|
139
|
+
dispatcher.forward(request, response);
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
}
|
18
146
|
|
19
147
|
コード
|
20
148
|
|
21
149
|
```
|
22
150
|
|
151
|
+
```HTML
|
152
|
+
|
153
|
+
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
154
|
+
|
155
|
+
pageEncoding="UTF-8"%>
|
156
|
+
|
157
|
+
<%@ page import="model.Branch" %>
|
158
|
+
|
159
|
+
<%@ page import="java.util.Arrays" %>
|
160
|
+
|
161
|
+
<% Branch branch =(Branch)request.getAttribute("branch"); %>
|
162
|
+
|
163
|
+
<% System.out.println("top1="+Arrays.toString(branch.getBranch()));%>
|
164
|
+
|
165
|
+
<!DOCTYPE html>
|
166
|
+
|
167
|
+
<html>
|
168
|
+
|
169
|
+
<head>
|
170
|
+
|
23
|
-
|
171
|
+
<meta charset="UTF-8">
|
172
|
+
|
24
|
-
|
173
|
+
<title>宛先別配送商品リスト発行</title>
|
174
|
+
|
175
|
+
</head>
|
176
|
+
|
177
|
+
<body>
|
178
|
+
|
25
|
-
|
179
|
+
<h1>宛先別配送商品リスト発行</h1>
|
180
|
+
|
26
|
-
|
181
|
+
<form action="/exampl/PickUp" method="post">
|
182
|
+
|
183
|
+
<input type="hidden" name="hoge" value="foo">
|
184
|
+
|
185
|
+
<select name="reprint" id="reprint"></select>
|
186
|
+
|
27
|
-
|
187
|
+
<input type="submit" value="発行">
|
188
|
+
|
28
|
-
|
189
|
+
</form>
|
190
|
+
|
191
|
+
<script type="text/javascript"src="/exampl/WEB-INF/jsp/reprintoption.js"></script>
|
192
|
+
|
193
|
+
</body>
|
194
|
+
|
29
|
-
|
195
|
+
</html>コード
|
30
|
-
|
31
|
-
タイプ ステータスレポート
|
32
|
-
|
33
|
-
オリジン オリジンサーバーはターゲットソースの現在の表現を見つけられなかったかまたはそれが存在することを開示す るつもりはありません。
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
196
|
|
39
197
|
```
|
40
198
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
i
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
import javax.servlet.http.HttpServletRequest;
|
68
|
-
|
69
|
-
import javax.servlet.http.HttpServletResponse;
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
import model.Branch;
|
74
|
-
|
75
|
-
import model.BranchGet;
|
76
|
-
|
77
|
-
import model.DataPrintable;
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
@WebServlet("/PickUp")
|
84
|
-
|
85
|
-
public class PickUp extends HttpServlet {
|
86
|
-
|
87
|
-
private static final long serialVersionUID = 1L;
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
public PickUp() {
|
94
|
-
|
95
|
-
super();
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
106
|
-
|
107
|
-
String[] branchw;
|
108
|
-
|
109
|
-
BranchGet bg = new BranchGet();
|
110
|
-
|
111
|
-
Branch branch = new Branch();
|
112
|
-
|
113
|
-
branchw=bg.execute();
|
114
|
-
|
115
|
-
branch.setBranch(branchw);
|
116
|
-
|
117
|
-
System.out.println("PickUp="+Arrays.toString(branchw));
|
118
|
-
|
119
|
-
request.setAttribute("branch",branch);
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/jsp/top.jsp");
|
124
|
-
|
125
|
-
dispatcher.forward(request, response);
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
@SuppressWarnings("static-access")
|
134
|
-
|
135
|
-
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
DataPrintable dp =new DataPrintable();
|
140
|
-
|
141
|
-
dp.main();
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/jsp/result.jsp");
|
146
|
-
|
147
|
-
dispatcher.forward(request, response);
|
148
|
-
|
149
|
-
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
```HTML
|
156
|
-
|
157
|
-
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
158
|
-
|
159
|
-
pageEncoding="UTF-8"%>
|
160
|
-
|
161
|
-
<%@ page import="model.Branch" %>
|
162
|
-
|
163
|
-
<%@ page import="java.util.Arrays" %>
|
164
|
-
|
165
|
-
<% Branch branch =(Branch)request.getAttribute("branch"); %>
|
166
|
-
|
167
|
-
<% System.out.println("top1="+Arrays.toString(branch.getBranch()));%>
|
168
|
-
|
169
|
-
<!DOCTYPE html>
|
170
|
-
|
171
|
-
<html>
|
172
|
-
|
173
|
-
<head>
|
174
|
-
|
175
|
-
<meta charset="UTF-8">
|
176
|
-
|
177
|
-
<title>宛先別配送商品リスト発行</title>
|
178
|
-
|
179
|
-
</head>
|
180
|
-
|
181
|
-
<body>
|
182
|
-
|
183
|
-
<h1>宛先別配送商品リスト発行</h1>
|
184
|
-
|
185
|
-
<form action="/exampl/PickUp" method="post">
|
186
|
-
|
187
|
-
<input type="hidden" name="hoge" value="foo">
|
188
|
-
|
189
|
-
<select name="reprint" id="reprint"></select>
|
190
|
-
|
191
|
-
<input type="submit" value="発行">
|
192
|
-
|
193
|
-
</form>
|
194
|
-
|
195
|
-
<script type="text/javascript"src="/exampl/WEB-INF/jsp/reprintoption.js"></script>
|
196
|
-
|
197
|
-
</body>
|
198
|
-
|
199
|
-
</html>
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
コード
|
199
|
+
```javascript
|
200
|
+
|
201
|
+
branchj = new Array;
|
202
|
+
|
203
|
+
branchj =Array.from(branch);
|
204
|
+
|
205
|
+
let reprint = document.getElementById('reprint');
|
206
|
+
|
207
|
+
document.createElement('option')
|
208
|
+
|
209
|
+
for (let i =0;i<branchj.length;i++){
|
210
|
+
|
211
|
+
let option =document.createElement("option");
|
212
|
+
|
213
|
+
option.SetAttribute('value',branchj[i]);
|
214
|
+
|
215
|
+
option.innnerHtml = branchj[i];
|
216
|
+
|
217
|
+
reprint.appendChild(option);
|
218
|
+
|
219
|
+
};
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
コード
|
204
224
|
|
205
225
|
```
|
206
226
|
|
207
|
-
```
|
208
|
-
|
209
|
-
JavaScript
|
210
|
-
|
211
|
-
branchj = new Array;
|
212
|
-
|
213
|
-
branchj =Array.from(branch);
|
214
|
-
|
215
|
-
let reprint = document.getElementById('reprint');
|
216
|
-
|
217
|
-
document.createElement('option')
|
218
|
-
|
219
|
-
for (let i =0;i<branchj.length;i++){
|
220
|
-
|
221
|
-
let option =document.createElement("option");
|
222
|
-
|
223
|
-
option.SetAttribute('value',branchj[i]);
|
224
|
-
|
225
|
-
option.innnerHtml = branchj[i];
|
226
|
-
|
227
|
-
reprint.appendChild(option);
|
228
|
-
|
229
|
-
};
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
```
|
238
|
-
|
239
227
|
### 試したこと
|
240
228
|
|
241
229
|
|