質問編集履歴
4
Ajaxの書き方が公式で非推奨の書き方だったので修正いたしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -98,7 +98,7 @@
|
|
98
98
|
|
99
99
|
data: Data,
|
100
100
|
|
101
|
-
|
101
|
+
}).done(function(date){
|
102
102
|
|
103
103
|
Data1 = data["Data1"];
|
104
104
|
|
@@ -108,13 +108,17 @@
|
|
108
108
|
|
109
109
|
console.log("接続成功");
|
110
110
|
|
111
|
-
},
|
112
|
-
|
113
111
|
})
|
114
112
|
|
115
113
|
.fail(function(XMLHttpRequest, textStatus, errorThrown){
|
116
114
|
|
115
|
+
console.log("XMLHttpRequest : " + XMLHttpRequest.status);
|
116
|
+
|
117
|
-
|
117
|
+
console.log("textStatus : " + textStatus);
|
118
|
+
|
119
|
+
console.log("errorThrown : " + errorThrown.message);
|
120
|
+
|
121
|
+
console.log("失敗");
|
118
122
|
|
119
123
|
});
|
120
124
|
|
@@ -230,11 +234,11 @@
|
|
230
234
|
|
231
235
|
request.setCharacterEncoding("utf-8");
|
232
236
|
|
233
|
-
String res1= request.getParameter("DATA1");
|
237
|
+
String res1= request.getParameter("DATA1");
|
234
|
-
|
238
|
+
|
235
|
-
String res2 = request.getParameter("DATA2");
|
239
|
+
String res2 = request.getParameter("DATA2");
|
236
|
-
|
240
|
+
|
237
|
-
String res3 = request.getParameter("DATA3");
|
241
|
+
String res3 = request.getParameter("DATA3");
|
238
242
|
|
239
243
|
|
240
244
|
|
3
JAVAソースの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -180,7 +180,7 @@
|
|
180
180
|
|
181
181
|
*/
|
182
182
|
|
183
|
-
@WebServlet("/Connect")
|
183
|
+
@WebServlet("/API/Connect")
|
184
184
|
|
185
185
|
public class Connect extends HttpServlet {
|
186
186
|
|
2
javaソースの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,6 +30,14 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
+
追記
|
34
|
+
|
35
|
+
javaソースのprotected void doPost(HttpServletRequest...の部分をprotected → publicに変更したところコンソールでDataの内容は出力できましたが、Ajaxはfailのままでした。
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
33
41
|
```console.log
|
34
42
|
|
35
43
|
failのconsole.logの内容
|
@@ -206,7 +214,7 @@
|
|
206
214
|
|
207
215
|
*/
|
208
216
|
|
209
|
-
p
|
217
|
+
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
210
218
|
|
211
219
|
// TODO Auto-generated method stub
|
212
220
|
|
1
failのconsole.logの出力
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,6 +30,24 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
+
```console.log
|
34
|
+
|
35
|
+
failのconsole.logの内容
|
36
|
+
|
37
|
+
POST http://localhost:8080/API/Connect 404
|
38
|
+
|
39
|
+
send @jquery.min.js:2
|
40
|
+
|
41
|
+
ajax @jquery.min.js:2
|
42
|
+
|
43
|
+
connect @ApiConnect.jsp:16
|
44
|
+
|
45
|
+
onclick @ApiConnect.jsp:42
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
|
33
51
|
```jsp
|
34
52
|
|
35
53
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
|