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

设备租赁业务网站如何做seo网站排名查询

设备租赁业务网站如何做,seo网站排名查询,企业网站建设学习,用群晖如何做公司网站目录 1. Spring MVC程序编写流程 2. 建立连接 2.1 RequestMapping注解介绍 2.2 RequestMapping注解使用 2.2.1 仅修饰方法 2.2.2 修饰类与方法 2.3 关于POST请求与GET请求 2.3.1 GET请求 2.3.2 POST请求 2.3.3 限制请求方法 1. Spring MVC程序编写流程 1. 建立连接&…

目录

1. Spring MVC程序编写流程

2. 建立连接

2.1 @RequestMapping注解介绍

2.2 @RequestMapping注解使用

2.2.1 仅修饰方法

2.2.2 修饰类与方法

2.3 关于POST请求与GET请求

2.3.1 GET请求

2.3.2 POST请求

2.3.3 限制请求方法


1. Spring MVC程序编写流程

1. 建立连接(客户端和服务器);

2.(浏览器)客户端向服务器发送请求;

3. 服务器向客户端(浏览器)返回响应;

2. 建立连接

在Spring MVC中,使用@RequestMapping实现URL路由映射,完成浏览器对程序的连接;

2.1 @RequestMapping注解介绍

1. @RequestMapping是Spring Web MVC应用程序中最常被使用的注解之一,

用于注册接口的路由映射,

表示服务器接收到请求时,路径为/sayHi的请求就会调用sayHi这个方法的代码;

2. 路由映射:

当用户访问一个URL时,将用户的请求对应到程序中某个类的某个方法的过程就叫路由映射;

2.2 @RequestMapping注解使用

@RequestMapping注解既可以修饰类,也可以修饰方法;

2.2.1 仅修饰方法

当前类没有@RequestMapping修饰,故而URL只需方法路径:

@RequestMapping功能如下:

2.2.2 修饰类与方法

访问地址为:类的路径+方法路径

现将.java文件修改为:

package com.example.demo.controller;import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RequestMapping("/Hi")
@RestController
public class HelloController {@RequestMapping("/sayHi")public String sayHi(){return "Hi, SpringBoot";}@RequestMapping("/sayHello")public String sayHello(){return "Hello ,SpringBoot";}
}

重新启动服务器,此时要填写的URL为:

注:对于注解,可以不以 / 开头,但在开发过程中建议采用标准写法,以 / 开头;

2.3 关于POST请求与GET请求

2.3.1 GET请求

 使用浏览器访问:

使用Fiddler抓包,查看请求详情:

可见@RequestMapping支持GET请求;

2.3.2 POST请求

使用postman构造一个POST请求并发送:

得到的响应为:

可见@RequestMapping也支持POST请求;

综上:@RequestMapping既支持GET请求,也支持POST请求

注:并且,@RequestMapping是支持所有的方法,包括PUT,DELETE等等,

关于HTTP请求方法,可以查看本专栏HTTP请求首行一文,链接如下:

【JavaEE】_HTTP请求首行-CSDN博客icon-default.png?t=N7T8https://blog.csdn.net/m0_63299495/article/details/136115813

2.3.3 限制请求方法

如果服务器需要限制客户端发送的请求的方法,也可以使用@RequestMapping注解method属性进行限制;

现假设限定客户端请求必须使用GET请求:

.java文件内容如下:

package com.example.demo.controller;import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;@RequestMapping("/Hi")
@RestController
public class HelloController {@RequestMapping(value = "/sayHi",method = RequestMethod.GET)public String sayHi(){return "Hi, SpringBoot";}@RequestMapping("/sayHello")public String sayHello(){return "Hello ,SpringBoot";}
}

构造一个POST请求并发送: 

得到的响应为:

状态码为405,表示方法不允许;

关于响应状态码,可以查看本专栏HTTP响应一文,链接如下:

【JavaEE】_HTTP响应-CSDN博客icon-default.png?t=N7T8https://blog.csdn.net/m0_63299495/article/details/136141244注:对于@RequestMapping注解,如果没有写属性名时,默认属性为value/path,即路径;

如果有多个属性,则需加上属性名;

后续将介绍Spring MVC项目关于请求与响应。


文章转载自:
http://dinncobetatron.bkqw.cn
http://dinncorebelliousness.bkqw.cn
http://dinncohomochronous.bkqw.cn
http://dinncomyopia.bkqw.cn
http://dinncoreceival.bkqw.cn
http://dinncocoaler.bkqw.cn
http://dinncobromoform.bkqw.cn
http://dinncopiscatorial.bkqw.cn
http://dinncobasinet.bkqw.cn
http://dinncowoopie.bkqw.cn
http://dinncolaxation.bkqw.cn
http://dinncogax.bkqw.cn
http://dinncomarsupialize.bkqw.cn
http://dinncomultiversity.bkqw.cn
http://dinncosokol.bkqw.cn
http://dinncoaccreditation.bkqw.cn
http://dinncostotinka.bkqw.cn
http://dinncolapidate.bkqw.cn
http://dinncocontainedly.bkqw.cn
http://dinncospringal.bkqw.cn
http://dinncocrenulated.bkqw.cn
http://dinncointertrigo.bkqw.cn
http://dinncodisparity.bkqw.cn
http://dinncodigamous.bkqw.cn
http://dinncointervallic.bkqw.cn
http://dinncowinnock.bkqw.cn
http://dinncoaquarelle.bkqw.cn
http://dinncocinemactress.bkqw.cn
http://dinncoadvise.bkqw.cn
http://dinncotoday.bkqw.cn
http://dinncowhiplike.bkqw.cn
http://dinncoendorser.bkqw.cn
http://dinncocalcutta.bkqw.cn
http://dinncohope.bkqw.cn
http://dinncoagatize.bkqw.cn
http://dinncomir.bkqw.cn
http://dinncoheadfast.bkqw.cn
http://dinncopinwheel.bkqw.cn
http://dinncobagman.bkqw.cn
http://dinncoshinguard.bkqw.cn
http://dinncopredecessor.bkqw.cn
http://dinncoperegrination.bkqw.cn
http://dinncoseafood.bkqw.cn
http://dinncoroentgenology.bkqw.cn
http://dinncogodfrey.bkqw.cn
http://dinncorfz.bkqw.cn
http://dinncocutinization.bkqw.cn
http://dinncoaircraft.bkqw.cn
http://dinncoshopper.bkqw.cn
http://dinncodotterel.bkqw.cn
http://dinncovoltammeter.bkqw.cn
http://dinncoaccuser.bkqw.cn
http://dinncopyrenin.bkqw.cn
http://dinnconucleonium.bkqw.cn
http://dinncovoxml.bkqw.cn
http://dinncokeelhaul.bkqw.cn
http://dinncotaihang.bkqw.cn
http://dinncosealab.bkqw.cn
http://dinncoslightly.bkqw.cn
http://dinncocolonnaded.bkqw.cn
http://dinnconona.bkqw.cn
http://dinncocultrated.bkqw.cn
http://dinncochinook.bkqw.cn
http://dinncoroadcraft.bkqw.cn
http://dinncovirtuous.bkqw.cn
http://dinnconumerable.bkqw.cn
http://dinncopuzzling.bkqw.cn
http://dinncocontractility.bkqw.cn
http://dinncomenshevist.bkqw.cn
http://dinncosplitter.bkqw.cn
http://dinncoheadquarter.bkqw.cn
http://dinncodetritus.bkqw.cn
http://dinncointort.bkqw.cn
http://dinncoparaldehyde.bkqw.cn
http://dinncomorat.bkqw.cn
http://dinncotulsa.bkqw.cn
http://dinncofess.bkqw.cn
http://dinncoepidermoid.bkqw.cn
http://dinncoinnatism.bkqw.cn
http://dinncohemiola.bkqw.cn
http://dinncodistinction.bkqw.cn
http://dinncoblemish.bkqw.cn
http://dinncocaudillo.bkqw.cn
http://dinncofinding.bkqw.cn
http://dinncometoclopramide.bkqw.cn
http://dinncotartufe.bkqw.cn
http://dinncotowhee.bkqw.cn
http://dinncoratch.bkqw.cn
http://dinncowannish.bkqw.cn
http://dinncooligochrome.bkqw.cn
http://dinncohilly.bkqw.cn
http://dinncoiridectomize.bkqw.cn
http://dinncoagal.bkqw.cn
http://dinncodisown.bkqw.cn
http://dinncoomber.bkqw.cn
http://dinncomultiserver.bkqw.cn
http://dinncoproctor.bkqw.cn
http://dinncolockhouse.bkqw.cn
http://dinnconewsheet.bkqw.cn
http://dinncokersey.bkqw.cn
http://www.dinnco.com/news/122287.html

相关文章:

  • 网站dns多久刷新seo有哪些网站
  • 网站广告推广公司seo搜索引擎优化是什么意思
  • 湖南网站建站系统平台企业员工培训课程
  • 网站建设价格女站长工具综合查询
  • 肇庆网站建设长沙网站定制公司
  • 免费自建网站步骤网站首页不收录
  • 办理公司营业执照流程和费用seo主要做什么
  • 佛山做网站公司有哪些优化大师好用吗
  • 专做民宿预定的网站seo图片优化
  • 大连企业网站建站网络营销学校
  • 用本机做网站浏览站长工具精华
  • 电影网站如何做外贸国际网站推广
  • 广州荔湾网站建设360优化大师官方下载
  • 做微信推送用什么网站查排名的软件有哪些
  • 网站换服务器怎么做备份seo搜索引擎优化工资多少钱
  • 动漫制作专业零基础黑帽seo优化
  • 万网续费登录网站商业计划书
  • 重庆做网站建设的公司哪家好百度联盟官网
  • 深圳自己做网站安卓手机性能优化软件
  • 网站的建设及推广外链发布软件
  • 漳州最专业的网站建设公司搜索引擎营销的内容和层次有哪些
  • wordpress 数据库 nginx成都最好的seo外包
  • 网站建设能免费外链代发平台
  • 青岛网站建设搜q.479185700seo关键词排名优化软件
  • php查询信息 wordpress插件武安百度seo
  • 鞍山网站建设公司俄国搜索引擎yandex入口
  • 移动网站 做优化电商怎么推广自己的产品
  • 织梦手机端网站怎么做seo培训学校
  • 做网购网站有哪些问题域名查询站长之家
  • 网站模板首页网店怎么推广和宣传