1. 首页
  2. 软件开发
  3. JAVA
  4. SpringMVC中controller接收json数据的方法

SpringMVC中controller接收json数据的方法

  • 发布于 2024-09-25
  • 1 次阅读

注意:

1.在发送数据时,data键的值一定要写成JSON.stringify(json),将数据转换成json格式,否则会抛出异常

2.basePath是项目根目录:

<%

String path = request.getContextPath();

String basePath = request.getScheme()+`“://“+request.getServerName()+“:“+request.getServerPort()+path+“/“`;

%>

controller接收参数时,只要用把 datas传获取就行了

原文链接: https://onlyou.blog.csdn.net//article/details/86226952