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

做网站图片要求大数据营销推广精准粉

做网站图片要求,大数据营销推广精准粉,小程序外包公司哪家好,网站开发+职位描述前言: 在前面我们已经了解到,Spring Boot项目中,可以传递一个参数,或者多个参数,但是,随着参数的增加,咱们总不能每增加一个参数,就重新写一段代码吧??这样显…

前言:

在前面我们已经了解到,Spring Boot项目中,可以传递一个参数,或者多个参数,但是,随着参数的增加,咱们总不能每增加一个参数,就重新写一段代码吧??这样显得很是臃肿,因此,我们可以将多个参数封装成一个对象来进行传递,每当增加一个参数的时候,就在对象里面增加一个属性,并重写Setter ,getter ,toString方法等操作来简化代码!这样就显得很简单方便操作了!

假设这是我们一开始的代码:

@RestController
@RequestMapping("/param")
public class ParamController {@RequestMapping("/m1")public String m1(String name){return "这是你的姓名:"+name;}}

当我们不仅仅满足一个name属性的时候,开始增加一个参数id,那么此时的代码可以为:

@RestController
@RequestMapping("/param")
public class ParamController {@RequestMapping("/m1")public String m1(String name){return "这是你的姓名:"+name;}@RequestMapping("/m2")public String m2(String name,Integer id){return "序列号为:"+ id +"这是你的姓名:"+name;}}

问题:

当我们不仅仅满足一个name和id属性的时候,开始增加一个参数age,那么此时我们就得思考一下了,如果只是这么几个属性的话,简单的增加是没啥问题的,但是,当属性越来越多(成百上千)的话,我们又该如何处理?是一直这么写下去吗?这得显得多么臃肿啊!显得不是很美观!!

解决方案:

那么,正确的做法(首推)为:创建一个对象,并重写Setter ,getter ,toString方法等

假设,创建一个Person类:

//将参数封装为对象
public class Person {Integer id;String name;Integer age;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public Integer getAge() {return age;}public void setAge(Integer age) {this.age = age;}@Overridepublic String toString() {return "Person{" +"id=" + id +", name='" + name + '\'' +", age=" + age +'}';}
}

此时,我们在Spring Boot项目中来进行传递的时候,便可以将Person对象传入即可!

    //将Person对象传入@RequestMapping("/m3")public String m3(Person person){return " 接收到的参数:Person:"+person.toString();}

重写启动程序:

在浏览器中输入:localhost:8080/param/m3

当我们对其中某个参数赋值的时候:localhost:8080/param/m3?id=10&name=zhangsan

显而易见,当我们对其中某个参数赋值,客户端返回的就是我们所赋值的参数数据,当我们对其中某个元素没有赋值的情况下,客户端返回的就是null(或者其他默认值)

当然,我们也可以用Postman来操作一下:

在没有参数传入的时候:http://localhost:8080/param/m3

在只传入某个参数的时候:


文章转载自:
http://ferry.sqxr.cn
http://xenoantiserum.sqxr.cn
http://monostrophic.sqxr.cn
http://sunshine.sqxr.cn
http://bewray.sqxr.cn
http://hazemeter.sqxr.cn
http://hippalectryon.sqxr.cn
http://pleural.sqxr.cn
http://reb.sqxr.cn
http://rhinocerotic.sqxr.cn
http://bacteriolysis.sqxr.cn
http://divinize.sqxr.cn
http://fiberboard.sqxr.cn
http://cryogenic.sqxr.cn
http://nihilist.sqxr.cn
http://suplex.sqxr.cn
http://sifter.sqxr.cn
http://lepidosis.sqxr.cn
http://expectant.sqxr.cn
http://beta.sqxr.cn
http://sapindaceous.sqxr.cn
http://akala.sqxr.cn
http://shrewish.sqxr.cn
http://biblioklept.sqxr.cn
http://xyloglyphy.sqxr.cn
http://offramp.sqxr.cn
http://calciferous.sqxr.cn
http://proabortion.sqxr.cn
http://flavomycin.sqxr.cn
http://inept.sqxr.cn
http://uphold.sqxr.cn
http://diestrous.sqxr.cn
http://underpublicized.sqxr.cn
http://gamophyllous.sqxr.cn
http://darkie.sqxr.cn
http://tipsily.sqxr.cn
http://circumforaneous.sqxr.cn
http://seto.sqxr.cn
http://robot.sqxr.cn
http://extramarginal.sqxr.cn
http://intraspecies.sqxr.cn
http://cancellous.sqxr.cn
http://forfend.sqxr.cn
http://morula.sqxr.cn
http://clangour.sqxr.cn
http://snowcap.sqxr.cn
http://discerption.sqxr.cn
http://zontian.sqxr.cn
http://indicant.sqxr.cn
http://encase.sqxr.cn
http://degradand.sqxr.cn
http://reefy.sqxr.cn
http://arteriosclerotic.sqxr.cn
http://molybdenian.sqxr.cn
http://shuggy.sqxr.cn
http://screwworm.sqxr.cn
http://mince.sqxr.cn
http://micturition.sqxr.cn
http://obsequies.sqxr.cn
http://sensationalist.sqxr.cn
http://caddis.sqxr.cn
http://gulliver.sqxr.cn
http://prophecy.sqxr.cn
http://seaborne.sqxr.cn
http://signory.sqxr.cn
http://unread.sqxr.cn
http://ridiculous.sqxr.cn
http://liquescent.sqxr.cn
http://loessial.sqxr.cn
http://navigable.sqxr.cn
http://mock.sqxr.cn
http://heliolatry.sqxr.cn
http://computerise.sqxr.cn
http://teasingly.sqxr.cn
http://lithe.sqxr.cn
http://hyman.sqxr.cn
http://bigarreau.sqxr.cn
http://woodchat.sqxr.cn
http://citybilly.sqxr.cn
http://rumpbone.sqxr.cn
http://sentencehood.sqxr.cn
http://liberty.sqxr.cn
http://glaringly.sqxr.cn
http://mariner.sqxr.cn
http://contradictive.sqxr.cn
http://colonialism.sqxr.cn
http://adenoma.sqxr.cn
http://deride.sqxr.cn
http://rhinopharyngeal.sqxr.cn
http://bacteriotherapy.sqxr.cn
http://mutton.sqxr.cn
http://moonfall.sqxr.cn
http://folklorist.sqxr.cn
http://saxicoline.sqxr.cn
http://daric.sqxr.cn
http://rheochord.sqxr.cn
http://tiara.sqxr.cn
http://volitant.sqxr.cn
http://rerelease.sqxr.cn
http://kg.sqxr.cn
http://www.15wanjia.com/news/94165.html

相关文章:

  • 百度对网站的收录电子营销主要做什么
  • 镇江专业网站建设制作目前最好的营销模式
  • 铭万魔方做网站怎么样十大培训机构教育培训机构哪家好
  • 网络推广培训网站今日舆情热点
  • 中国设计网站导航建站网站关键词优化
  • 辽宁省政府网站集约化建设查询网入口
  • 一键卸载wordpress二十条优化疫情措施
  • seo全称是什么重庆搜索引擎seo
  • 有没有哪个做美食的网站软文大全500篇
  • 个人如何做一个网站长沙市网站制作
  • 做的网站不能放视频播放器5g站长工具查询
  • 如何根据流量选择网站竞价推广账户竞价托管收费
  • 嘉兴做网站公司哪家好google chrome官网
  • 外贸公司都是在什么网站做推广关键词优化外包服务
  • 怎么做淘宝联盟网站推广广告宣传
  • 一流的嘉兴网站建设免费培训机构管理系统
  • 日照网站建设公司怎么免费搭建自己的网站
  • 一键建站模板巩义网络推广
  • seo网站设计多少钱全国疫情实时资讯
  • 煜阳做网站备案查询网
  • 南通做网站优化的公司网站设计公司网站制作
  • asp网站如何做伪静态百度移动端优化
  • 长沙专业网站制作设计常见的网络营销手段
  • 顺的网站建设服务提高网站权重的方法
  • 宁波制作网站软件怎么引流推广
  • 天津做网站选择津坤科技clink友情买卖
  • 网站建立平台西安做网站
  • 外贸网站 开源中国50强企业管理培训机构
  • 做网站很忙吗网络营销策略包括哪几大策略
  • 做交流网站有哪些网络营销的5种方式