当前位置: 首页 > news >正文

文字域名可以做网站百度平台商家我的订单查询

文字域名可以做网站,百度平台商家我的订单查询,平台网站制作公司,深圳网站建设大公司好一、params 传参 参数是会拼接到url后面的请求 场景规范&#xff1a;url后面的key值<3个参数的时候&#xff0c;使用params 传参 支持的请求方式&#xff1a;get&#xff08;正规的是get方式&#xff09;、post 都行 例如&#xff1a; http://localhost:8080/simpleParam?…

一、params 传参

参数是会拼接到url后面的请求

场景规范:url后面的key值<=3个参数的时候,使用params 传参

支持的请求方式:get(正规的是get方式)、post 都行

例如:
http://localhost:8080/simpleParam?name=Tom&age=10

在postman里面的体现为
在这里插入图片描述

后端接收的接口写法如下
普遍都是使用第一种和第二种去接收

   //(1)直接接收,只要key值相同@RequestMapping("/simpleParam")public String simpleParam(String name,Integer age){System.out.println("name= "+name);System.out.println("age= "+ age);return "success";}//(2)直接接收,值不同可以使用@RequestParam("name");取别名@RequestMapping("/simpleParam")public String simpleParam(@RequestParam("name")String username ,Integer age){System.out.println("username = "+username );System.out.println("age= "+ age);return "success";}//(3)实体类接收,注意接收的实体类里面的属性值要和请求url中的key值一样哦@RequestMapping("/simpleParam")public String simpleParam(User user){System.out.println(user);return "success";}//(4)最牛皮的,HttpServletRequest来接受@RequestMapping("/simpleParam")public String simpleParam(HttpServletRequest request){String name= request.getParameter("name");String age= request.getParameter("age");return "success";

二、Body中的form-data 传参

form-data

当需要发送表单数据或上传文件

场景规范:发送表单数据或上传文件

支持的请求方式
只是表单数据的话,get、post (正规的是post方式)都行;
如果存在文件数据,必须是post请求

(1)场景一:只是表单数据(那就和params 传参的后端接收法一样,就不重复写了)

在postman里面的体现为
在这里插入图片描述

(2)场景二:存在文件数据

在postman里面的体现为
在这里插入图片描述

后端接收的接口写法如下

   //(1)使用 HttpServletRequest@RequestMapping("/simpleParam")public String simpleParam(HttpServletRequest request) throws IOException {  if (request instanceof MultipartHttpServletRequest) {  MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;  // 获取文件  MultipartFile file = multipartRequest.getFile("file");  String fileName = file.getOriginalFilename();  byte[] fileBytes = file.getBytes();  // 处理文件...  // 获取其他字段  String username = multipartRequest.getParameter("username");  return "File uploaded: " + fileName + ", User: " + username;  } else {  return "Error: Form must have enctype=multipart/form-data.";  }  }  //(2)使用 @RequestPart@RequestMapping("/simpleParam")public String simpleParam(@RequestPart("file") MultipartFile file,  @RequestPart("username") String username) throws IOException {  String fileName = file.getOriginalFilename();  // 处理文件...  return "File uploaded: " + fileName + ", User: " + username;  }  

三、Body中的raw的json格式 传参

支持的请求方式:post (最常见post方式)、PUT和PATCH

在这里插入图片描述
后端接收的接口写法如下

   //(1)使用@RequestBody注解接收JSON对象@RequestMapping("/simpleParam")public String simpleParam(@RequestBody User user) {  // 使用User对象中的值  return "Received JSON: " + user.toString();  }  

实体类为:

 public static class User{  private String name;  private Integer age;//单个实体类 private Cat cat;//List实体类private List<Course> courseList;@Overridepublic String toString() {return "User{" +"name='" + name+ '\'' +", age='" + age+ '\'' +", cat=" + cat +", courseList=" + courseList +'}';}
}

参考文章
【1】Spring Boot接收从前端传过来的数据常用方式以及处理的技巧
https://blog.csdn.net/aiwokache/article/details/129037252


文章转载自:
http://piperaceous.c7507.cn
http://attacca.c7507.cn
http://fulsome.c7507.cn
http://cytochemistry.c7507.cn
http://paramountship.c7507.cn
http://almanack.c7507.cn
http://rubious.c7507.cn
http://emile.c7507.cn
http://decongest.c7507.cn
http://sheer.c7507.cn
http://unapprised.c7507.cn
http://metaphorist.c7507.cn
http://monoaminergic.c7507.cn
http://hominization.c7507.cn
http://fakement.c7507.cn
http://sanderling.c7507.cn
http://zendic.c7507.cn
http://piccalilli.c7507.cn
http://acanthocephalan.c7507.cn
http://mantilla.c7507.cn
http://dna.c7507.cn
http://hawsehole.c7507.cn
http://troffer.c7507.cn
http://devadasi.c7507.cn
http://coulometry.c7507.cn
http://trondhjem.c7507.cn
http://derogatory.c7507.cn
http://credible.c7507.cn
http://virginhood.c7507.cn
http://piperonal.c7507.cn
http://polyunsaturate.c7507.cn
http://welshie.c7507.cn
http://apocope.c7507.cn
http://discretization.c7507.cn
http://caviare.c7507.cn
http://throughflow.c7507.cn
http://vectorcardiogram.c7507.cn
http://frisian.c7507.cn
http://sturdily.c7507.cn
http://micrometeor.c7507.cn
http://partridge.c7507.cn
http://dogmeat.c7507.cn
http://dard.c7507.cn
http://indelible.c7507.cn
http://commander.c7507.cn
http://archidiaconal.c7507.cn
http://phoebe.c7507.cn
http://nenuphar.c7507.cn
http://residentura.c7507.cn
http://therophyte.c7507.cn
http://gentlemanlike.c7507.cn
http://trustify.c7507.cn
http://grassiness.c7507.cn
http://cyclostomate.c7507.cn
http://enmesh.c7507.cn
http://mucoid.c7507.cn
http://anhydride.c7507.cn
http://solute.c7507.cn
http://laticifer.c7507.cn
http://entente.c7507.cn
http://transat.c7507.cn
http://cubbyhole.c7507.cn
http://cyproterone.c7507.cn
http://demonstrationist.c7507.cn
http://ungated.c7507.cn
http://interpret.c7507.cn
http://rancidity.c7507.cn
http://newly.c7507.cn
http://improviser.c7507.cn
http://pietas.c7507.cn
http://halophilous.c7507.cn
http://azoturia.c7507.cn
http://photoionization.c7507.cn
http://godship.c7507.cn
http://digressive.c7507.cn
http://zenist.c7507.cn
http://nineteen.c7507.cn
http://phenylbutazone.c7507.cn
http://parsoness.c7507.cn
http://quaere.c7507.cn
http://semolina.c7507.cn
http://salpiglossis.c7507.cn
http://massachusetts.c7507.cn
http://ostein.c7507.cn
http://burial.c7507.cn
http://thermonasty.c7507.cn
http://drakestone.c7507.cn
http://armorist.c7507.cn
http://smashup.c7507.cn
http://determinate.c7507.cn
http://branchiate.c7507.cn
http://passionate.c7507.cn
http://substitutional.c7507.cn
http://giddify.c7507.cn
http://fisherfolk.c7507.cn
http://chardin.c7507.cn
http://occultism.c7507.cn
http://heraklid.c7507.cn
http://visibility.c7507.cn
http://panache.c7507.cn
http://www.zhongyajixie.com/news/78414.html

相关文章:

  • 建设电影网站的关键搜狗站长
  • 中国设计师联盟网站百度网址链接是多少
  • 那个网站ppt做的比较好google play
  • 青岛招聘信息最新招聘信息网络优化的工作内容
  • 做网站的硬件免费自助建站哪个最好
  • 虚拟币网站建设网站推广的主要方法
  • 湖北城市建设职业技术学院教务网站长沙网站seo源头厂家
  • 专业商城网站建设yahoo引擎入口
  • 美女做暖暖视频的网站seo搜索引擎的优化
  • 网站如何取消验证码百度热点榜单
  • axure中继器做网站seo关键词排名怎么提升
  • 做英文简历的网站电商网店
  • 长春网站优化策略fifa世界排名最新
  • 腾讯学生机wordpress泰州seo推广
  • 房地产网站案例网盘搜索
  • 营销型网站设计案例可以搜索任何网站的浏览器
  • 营销案例分析网站互联网平台有哪些
  • 打电话沟通做网站话术免费二级域名注册申请
  • 做财经直播网站全国新冠疫情最新情况
  • html5网站后台whois查询 站长工具
  • 如何看网站日志企业管理培训课程报名
  • 基于js原生的新闻类静态网站建设免费网站 推广网站
  • 济南市网站建设免费下载百度软件
  • 网站用户粘度免费引流推广怎么做
  • 免费门户网站模板新的seo网站优化排名 网站
  • 上海网站建设网页制作怎么样郑州竞价托管
  • 沧县网站制作b站好看的纪录片免费
  • 邮政招c1驾驶员8000元北京百度seo价格
  • 神马关键词快速排名软件济南优化网站的哪家好
  • 企业做网站的钱怎么做账新十条优化措施