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

哪个网站做的简历最好搜索引擎优化的方式

哪个网站做的简历最好,搜索引擎优化的方式,软件开发和网页设计的区别,wordpress图片分页目录 一、引子 二、注解解析 RequestParam 一、要求形参名请求参数名,或者是请求实体类时(已有实体类),可以不需要加该注解 二、请求参数名!参数名时,需要写该注解RequestParam,其中 三、一名多值的情…

目录

一、引子

二、注解解析

@RequestParam

一、要求形参名=请求参数名,或者是请求实体类时(已有实体类),可以不需要加该注解

二、请求参数名!=参数名时,需要写该注解@RequestParam,其中

三、一名多值的情况使用list时,需要用到该注解@RequestParam,将集合add加入对应数据类型

@PathVariable

@RequestBody

@RequestHeader


一、引子

最近在写项目时,时不时会忘记或者漏写对应的参数注解,所以决定简单整理一下相关注解。

二、注解解析

@RequestParam

一、要求形参名=请求参数名,或者是请求实体类时(已有实体类),可以不需要加该注解

package com.atguigu.param;import com.atguigu.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import java.util.List;@Controller
@RequestMapping("param")
public class ParamController {@RequestMapping("data")@ResponseBody//直接接收//要求请求参数名=形参名public String data(String name,int age){System.out.println("name = " + name + ", age = " + age);return "name = " + name + ", age = " + age;}@GetMapping("data3")@ResponseBody//使用实体对象接值public String data3(User user){System.out.println("user = " + user);return "user = " + user;}}

二、请求参数名!=参数名时,需要写该注解@RequestParam,其中

value=“指定请求参数名”

required=false,前端是否必须传递此参数,默认是必须,不传报错400

default=“1”,当非必须传递false,可以设默认值

package com.atguigu.param;import com.atguigu.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import java.util.List;@Controller
@RequestMapping("param")
public class ParamController {@GetMapping("data1")@ResponseBody//注解指定public String data1(@RequestParam(value = "account") String username,@RequestParam(required = false,defaultValue = "1") int page){System.out.println("username = " + username + ", page = " + page);return "username = " + username + ", page = " + page;}}

三、一名多值的情况使用list时,需要用到该注解@RequestParam,将集合add加入对应数据类型

如果不加该注解,将会让hbs对应的一个字符串直接赋值给集合。

package com.atguigu.param;import com.atguigu.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import java.util.List;@Controller
@RequestMapping("param")
public class ParamController {@GetMapping("data2")@ResponseBody//特殊值一名多值public String data2(@RequestParam List<String> hbs){System.out.println("hbs = " + hbs);return "hbs = " + hbs;}}

@PathVariable

路径传参时,必须用到@PathVariable

package com.atguigu.path;import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;@Controller
@RequestMapping("path")
@ResponseBody
public class PathController {@GetMapping("{account}/{password}")public String login(@PathVariable String account,@PathVariable String password){System.out.println("account = " + account + ", password = " + password);return "account = " + account + ", password = " + password;}}

@RequestBody

前端传入json数据时需要用到@RequestBody,如@PostMapping,@DeleteMapping,@PutMapping中有时会用到

package com.atguigu.json;import com.atguigu.pojo.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;@Controller
@RequestMapping("json")
@ResponseBody
public class JsonController {@PostMapping("data")public String data(@RequestBody Person person){System.out.println("person = " + person);return "person = " + person;}}

@RequestHeader

用于接收请求头

package com.atguigu.header;import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;@Controller
@RequestMapping("header")
@ResponseBody
public class HeaderController {@RequestMapping ("data")public String data(@RequestHeader String host){System.out.println("host = " + host);return "host = " + host;}}

http://www.ds6.com.cn/news/120630.html

相关文章:

  • 黄埔定制型网站建设百度推广怎么做步骤
  • 做网站反链百度推广找谁
  • 广州建站工作室深圳百度推广代理商
  • 上海知名网站北京首页关键词优化
  • 网络设计专业工资石家庄seo优化
  • 网站建设项目确认书百度搜索风云榜官网
  • 绵阳市 政府网站建设个人博客网页设计html
  • 网站开发怎么自学百度网站制作
  • 上海定制网站建设公司网络营销推广实训报告
  • 义乌网站建设推广全国疫情的最新数据
  • 给公司做网站怎么样每天三分钟新闻天下事
  • 做简历网站 39搜索引擎优化教程
  • 企业官方网站地址百度收录的网站多久更新一次
  • 做网站那个好云南网站建设百度
  • 做可直接下单购买的网站seo流量
  • 企业做网站需要租服务器吗白嫖永久服务器
  • html5做宠物饲养网站农业推广
  • 个人做网站郊游的英2023上海又出现疫情了
  • 织梦网站安全在线培训
  • 比较有名的diy制作网站如何开发一款app软件
  • 如何做品牌营销策划seo排名培训公司
  • 亚马逊跨境电商个人开店要多少钱系统优化的意义
  • 帝国和织梦那个做企业网站好昆明网站开发推广公司
  • 赌博网站做维护犯罪上海网站关键词排名优化报价
  • 软件开发流程及主要岗位seo外链在线提交工具
  • 适合新手做的网站宣城网站seo
  • 新闻头条新闻关于近期重大事件乌鲁木齐seo
  • 淘宝的网站是怎么做的网站制作企业
  • 中国上海门户网站公众号企业文化建设
  • 网站关键词排名检测工具班级优化大师官网登录