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

南充哪里做网站wordpress模板位置

南充哪里做网站,wordpress模板位置,朝阳百姓网免费发布信息,网络推广优化一、简介 REST#xff08;Representational State Transfer#xff09;#xff0c;表现形式状态转换,它是一种软件架构风格 当我们想表示一个网络资源的时候#xff0c;可以使用两种方式: 传统风格资源描述形式 http://localhost/user/getById?id1 查询id为1的用户信息…一、简介 RESTRepresentational State Transfer表现形式状态转换,它是一种软件架构风格 当我们想表示一个网络资源的时候可以使用两种方式: 传统风格资源描述形式 http://localhost/user/getById?id1 查询id为1的用户信息http://localhost/user/saveUser 保存用户信息 REST风格描述形式 http://localhost/user/1http://localhost/user 所以REST的优点有: 隐藏资源的访问行为无法通过地址得知对资源是何种操作书写简化 常用的请求GET , POST , PUT , DELETE。 发送GET请求是用来做查询发送POST请求是用来做新增发送PUT请求是用来做修改发送DELETE请求是用来做删除 二、具体代码 原始实现 //Controller //ResponseBody配置在类上可以简化配置表示设置当前每个方法的返回值都作为响应体 //ResponseBody RestController //使用RestController注解替换Controller与ResponseBody注解简化书写 RequestMapping(/books) public class BookController {// RequestMapping( method RequestMethod.POST) PostMapping //使用PostMapping简化Post请求方法对应的映射配置 public String save(RequestBody Book book){ System.out.println(book save... book); return {module:book save}; }// RequestMapping(value /{id} ,method RequestMethod.DELETE) DeleteMapping(/{id}) //使用DeleteMapping简化DELETE请求方法对应的映射配置 public String delete(PathVariable Integer id){ System.out.println(book delete... id); return {module:book delete}; }// RequestMapping(method RequestMethod.PUT) PutMapping //使用PutMapping简化Put请求方法对应的映射配置 public String update(RequestBody Book book){ System.out.println(book update...book); return {module:book update}; }// RequestMapping(value /{id} ,method RequestMethod.GET) GetMapping(/{id}) //使用GetMapping简化GET请求方法对应的映射配置 public String getById(PathVariable Integer id){ System.out.println(book getById...id); return {module:book getById}; }// RequestMapping(method RequestMethod.GET) GetMapping //使用GetMapping简化GET请求方法对应的映射配置 public String getAll(){ System.out.println(book getAll...); return {module:book getAll}; } } 更新后 //标准REST风格控制器开发 RestController RequestMapping(/books) public class BookController2 {PostMapping //添加public String save(RequestBody Book book){System.out.println(book save... book);return {module:book save};}DeleteMapping(/{id})public String delete(PathVariable Integer id){System.out.println(book delete... id);return {module:book delete};}PutMapping //修改public String update(RequestBody Book book){System.out.println(book update...book);return {module:book update};}GetMapping(/{id}) //get是查询public String getById(PathVariable Integer id){System.out.println(book getById...id);return {module:book getById};}GetMappingpublic String getAll(){System.out.println(book getAll...);return {module:book getAll};} } 注意要在SpringConfig配置类中加上 EnableWebMvc  注解目前用来解析json格式此注解功能很多 Configuration ComponentScan(com.itheima.controller) EnableWebMvc public class SpringMvcConfig { }
http://www.dnsts.com.cn/news/114333.html

相关文章:

  • 天津医疗行业网站建设国内酒店网站建设
  • 河南省监理协会官方网站建设遵义网络科技公司
  • 自己制作网页的网站网页设计作业选材
  • psd网站首页图片wordpress ftp账户
  • wordpress怎么做响应式网站曲靖网站网站建设
  • 自己如何制作网站营销策划推广公司
  • 宣城网站建设 有限公司wordpress 批量分类
  • windows和linux 做网站wordpress flv
  • 试用网站 源码做婚姻网站赚钱
  • 网站风险解除如何搜名字搜到自己做的网站
  • 大连 做网站凡高网站建设
  • 江苏省公路与水路建设网站网站建设贵不贵
  • 网站交易模块怎么做珠海模板网站建设公司
  • 咖啡网站设计建设深圳网页设计公司建设
  • asp做网站的步骤顺德中小企业网站建设
  • 福田做棋牌网站建设哪家技术好wordpress 参数传人
  • 初创业公司做网站门户网站简单模板
  • 如何百度到自己的网站做网站用php还是jsp
  • moodle做网站上海建设网站制作
  • 安平县做网站的有哪些对电子商务网站设计的理解
  • 做问卷调查的是哪个网站工程信息价在哪查询
  • 做神马网站优网站建设在windos的设置
  • 网站建设服务器租用吉林市建设工程档案馆网站
  • 创造与魔法官方网站-做自己喜欢的事免费申请微信
  • 提供手机网站建设企业动漫设计与制作怎么样
  • 西安网站设计锦wordpress免费教育机构主题
  • 开设计公司客源哪里找百度网站排名优化价格
  • 网站目录优化西安建设局网站首页
  • 视频网站的防盗链是怎么做的怎么在百度里面找网站
  • 做全英文网站厦门云端企业网站建设