|
|
@ -108,13 +108,13 @@ jquery的ajax传给后端的数据springboot居然接收不到 |
|
|
|
|
|
|
|
用ajax的前端代码如下: |
|
|
|
|
|
|
|
<img src="C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210108231726208.png" alt="image-20210108231726208" style="zoom:80%;" /> |
|
|
|
<img src="image-20210108231726208.png" alt="image-20210108231726208" style="zoom:80%;" /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
正常用表单提交的方法如下: |
|
|
|
|
|
|
|
![image-20210108232120541](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210108232120541.png) |
|
|
|
![image-20210108232120541](image-20210108232120541.png) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -122,7 +122,7 @@ jquery的ajax传给后端的数据springboot居然接收不到 |
|
|
|
|
|
|
|
后端代码如下: |
|
|
|
|
|
|
|
![image-20210108231944550](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210108231944550.png) |
|
|
|
![image-20210108231944550](image-20210108231944550.png) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +130,7 @@ jquery的ajax传给后端的数据springboot居然接收不到 |
|
|
|
|
|
|
|
用ajax发数据,结果如下:(好像第二行最前面少了一个问号?不知道表单提交的有没有) |
|
|
|
|
|
|
|
![image-20210108232255322](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210108232255322.png) |
|
|
|
![image-20210108232255322](image-20210108232255322.png) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -138,7 +138,7 @@ jquery的ajax传给后端的数据springboot居然接收不到 |
|
|
|
|
|
|
|
正常表单提交,结果如下: |
|
|
|
|
|
|
|
![image-20210108232403810](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210108232403810.png) |
|
|
|
![image-20210108232403810](image-20210108232403810.png) |
|
|
|
|
|
|
|
第二行为null是因为流只能读取一次 |
|
|
|
|
|
|
@ -146,11 +146,11 @@ jquery的ajax传给后端的数据springboot居然接收不到 |
|
|
|
|
|
|
|
修改以下后端代码,看看用表单提交的话InputStream是什么样的 |
|
|
|
|
|
|
|
![image-20210108232529868](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210108232529868.png) |
|
|
|
![image-20210108232529868](image-20210108232529868.png) |
|
|
|
|
|
|
|
输出! |
|
|
|
|
|
|
|
![image-20210108232612889](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210108232612889.png) |
|
|
|
![image-20210108232612889](image-20210108232612889.png) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -174,15 +174,15 @@ ajax那边不管data的数据有没有加上JSON.stringify()都不行 |
|
|
|
|
|
|
|
### springboot接收ajax
|
|
|
|
|
|
|
|
![image-20210109000921900](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210109000921900.png) |
|
|
|
![image-20210109000921900](image-20210109000921900.png) |
|
|
|
|
|
|
|
==注意画红框的这个类,这个类是需要可序列化的!!!== |
|
|
|
|
|
|
|
![image-20210109001010687](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210109001010687.png) |
|
|
|
![image-20210109001010687](image-20210109001010687.png) |
|
|
|
|
|
|
|
==前端传json时,需要加上JSON.Stringify== |
|
|
|
|
|
|
|
<img src="C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210109103550442.png" alt="image-20210109103550442" style="zoom:80%;" /> |
|
|
|
<img src="image-20210109103550442.png" alt="image-20210109103550442" style="zoom:80%;" /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -196,7 +196,7 @@ ajax那边不管data的数据有没有加上JSON.stringify()都不行 |
|
|
|
|
|
|
|
按理说ajax这么写就行了,我还特意加了async:false来取消异步 |
|
|
|
|
|
|
|
![image-20210109102502329](C:\Users\wyz\Desktop\云计算\期末大作业\DeliveryTakingSystem\image-20210109102502329.png) |
|
|
|
![image-20210109102502329](image-20210109102502329.png) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|