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

网站建设几个税点友情链接大全

网站建设几个税点,友情链接大全,网站设计公司有用吗,分析可口可乐网站建设的目的Java知识点总结:想看的可以从这里进入 目录3.2、常用的注解3.2、常用的注解 Controller:代表此类是一个控制器,需要配置包的扫描。Spring MVC 是通过组件扫描机制查找应用中的控制器类的 在Spring6.0之后要求控制层必须添加该注解才会被识别成…

Java知识点总结:想看的可以从这里进入

目录

      • 3.2、常用的注解

3.2、常用的注解

  • @Controller:代表此类是一个控制器,需要配置包的扫描。Spring MVC 是通过组件扫描机制查找应用中的控制器类的

    在Spring6.0之后要求控制层必须添加该注解才会被识别成一个Controller。

    Controller在SpringMVC中默认是单例的,因为我们基本不会在控制器里面定义属性,但如果在特殊情况需要定义属性的时候,可以在类上面加上注解@Scope(“prototype”)改为多例的模式.

  • @RequestMapping(“访问路径”):最常被用到的注解之一,可以标注在类和方法上,它将请求与处理请求的控制器方法关联起来,建立映射关系,映射一个url到控制器的一个特定方法,通过此路径调用相应方法。

    • 用在类上时:对此类中的方法都会生效,路径为(类+方法)
    • 用在方法上:和用在类上的组成一个完整的路径
    @Controller
    @RequestMapping("/test")
    public class TestController {//此时请求映射所映射的请求的请求路径为:/test/pagejump@RequestMapping("/pagejump")public String (){}
    }
    
    属性含义
    value用来设置控制器方法的请求映射地址,注解的默认属性,如果只要一个value 属性,属性名可以被省略,取值可以是一个字符串类型的数组({路径1,路径2,………}),表示该控制器方法可以匹配多个请求地址
    name性相当于方法的注释,用于解释这个方法是用来干什么的,使方法更易理解。
    method用来设置控制器方法支持的请求方式(GET、POST、DELETE、PUT)
    image-20230301180725668
    params指定请求中的参数,只有当请求中携带了符合条件的参数时,控制器方法才会对该请求进行处理。
    “param”:请求中必须携带名为 param 的参数
    “!param”:请求中不能携带名为 param 的参数
    “param=value”:请求中必须携带名为 param 的参数,且参数的取值必须为:value
    “param!=value”:请求中不能携带参数:param = value。
    headers用于设置请求中请求头信息(和params 用法类似 )
  • @RequestMapping的派生注解,用来处理不同的请求,RestFul风格中经常使用

    • @PostMapping():只处理post提交的请求
    • @GetMapping():只处理get提交的请求
    • @PutMapping():处理put请求的映射
    • @DeleteMapping:处理delete请求的映射
  • @RequestParam(“name的值”) :用于方法的参数前,用来处理前端提交数据名和方法参数名相匹配的问题(参数不能为空)

    • required:默认为true,不允许为空。设置成false,可以为空
    • defaultValue:可以修改默认值
    public void test(@RequestParam("userId") int id){
    }
    //它会把参数处理过后,再进入到方法中,比如如下:
    String userId = request.getParameter("userId");
    int id = Integer.getInteger(userId);
    
  • @SessionAttribute:用在参数前,用来获取sesion中设置过的数据(比如登录用户)

    public void test(@SessionAttribute("user") User user){
    }
    
  • @ResponseBody:用在方法上,使方法不再走视图解析器,而是返回字符串数据。.

  • @RequestBody:用于接收前端传来的实体,自动装配到对象中

    @PostMapping("/user")
    public String testRequestBody(@RequestBody User user) {System.out.println("获取到的username为:"+ user.getUsername());System.out.println("获取到的password为:"+user.getPassword());return "success";
    }
    
  • @PathVariable:用来获取 URL 参数,处理Restfull 风格

    //http://localhost:8080/user/{id}
    @GetMapping("/user/{id}")
    public String testPathvariable(@PathVariable(value="id") Integer id) {	//value可解决名字不匹配System.out.println("获取到的id为:"+id);return "success";
    }
    

文章转载自:
http://dinncohelga.ydfr.cn
http://dinncosiloxane.ydfr.cn
http://dinncotransfluence.ydfr.cn
http://dinncoguilloche.ydfr.cn
http://dinnconookie.ydfr.cn
http://dinncounbranded.ydfr.cn
http://dinncokukri.ydfr.cn
http://dinnconattily.ydfr.cn
http://dinncolame.ydfr.cn
http://dinncocytolysis.ydfr.cn
http://dinncoflagon.ydfr.cn
http://dinncochuckle.ydfr.cn
http://dinncoadjt.ydfr.cn
http://dinncoantiapartheid.ydfr.cn
http://dinncostrapped.ydfr.cn
http://dinncospacistor.ydfr.cn
http://dinncoshikoku.ydfr.cn
http://dinncoregretable.ydfr.cn
http://dinncophototaxis.ydfr.cn
http://dinncofabled.ydfr.cn
http://dinncounsalable.ydfr.cn
http://dinncosolenoglyph.ydfr.cn
http://dinncounrounded.ydfr.cn
http://dinncogynecomorphous.ydfr.cn
http://dinncomappable.ydfr.cn
http://dinncoselenite.ydfr.cn
http://dinncoundiversified.ydfr.cn
http://dinncointentional.ydfr.cn
http://dinncoserried.ydfr.cn
http://dinncoreimprison.ydfr.cn
http://dinncohemocytoblastic.ydfr.cn
http://dinncokyanite.ydfr.cn
http://dinncogibbon.ydfr.cn
http://dinncobasenji.ydfr.cn
http://dinncocommutate.ydfr.cn
http://dinncounfeeling.ydfr.cn
http://dinncoacronically.ydfr.cn
http://dinncoporifer.ydfr.cn
http://dinncoheterozygous.ydfr.cn
http://dinncoalternately.ydfr.cn
http://dinncopragmatic.ydfr.cn
http://dinncoevacuation.ydfr.cn
http://dinncotanna.ydfr.cn
http://dinncomacle.ydfr.cn
http://dinncoguerdon.ydfr.cn
http://dinncodeboost.ydfr.cn
http://dinncoangelus.ydfr.cn
http://dinncoanglicanism.ydfr.cn
http://dinncopraseodymium.ydfr.cn
http://dinncotypology.ydfr.cn
http://dinncoparliament.ydfr.cn
http://dinncofrgs.ydfr.cn
http://dinncostreamer.ydfr.cn
http://dinncoeffable.ydfr.cn
http://dinncoabbacy.ydfr.cn
http://dinncorubblework.ydfr.cn
http://dinncosilicon.ydfr.cn
http://dinncoccp.ydfr.cn
http://dinncodewlap.ydfr.cn
http://dinncoaudiphone.ydfr.cn
http://dinncouniatism.ydfr.cn
http://dinncoeatable.ydfr.cn
http://dinncofrigorific.ydfr.cn
http://dinncopomace.ydfr.cn
http://dinncorelativity.ydfr.cn
http://dinncointerpolator.ydfr.cn
http://dinncounzippered.ydfr.cn
http://dinncopastorally.ydfr.cn
http://dinncococomat.ydfr.cn
http://dinncodaltonism.ydfr.cn
http://dinncodyke.ydfr.cn
http://dinncobruxelles.ydfr.cn
http://dinncoshnaps.ydfr.cn
http://dinncoaglitter.ydfr.cn
http://dinncoforewarningly.ydfr.cn
http://dinncoclachan.ydfr.cn
http://dinncosmokechaser.ydfr.cn
http://dinncomatchstick.ydfr.cn
http://dinncointertropical.ydfr.cn
http://dinncoorangewood.ydfr.cn
http://dinncogypsography.ydfr.cn
http://dinncohour.ydfr.cn
http://dinncostructurize.ydfr.cn
http://dinncowheelrace.ydfr.cn
http://dinncoshovelbill.ydfr.cn
http://dinncopyelitis.ydfr.cn
http://dinncocursor.ydfr.cn
http://dinncometacomet.ydfr.cn
http://dinncostrook.ydfr.cn
http://dinncosibyl.ydfr.cn
http://dinncobelowdecks.ydfr.cn
http://dinncoconically.ydfr.cn
http://dinncobutcherly.ydfr.cn
http://dinncoproselytise.ydfr.cn
http://dinncoactinia.ydfr.cn
http://dinncolapin.ydfr.cn
http://dinncoquadriennium.ydfr.cn
http://dinncohuntsmanship.ydfr.cn
http://dinncovar.ydfr.cn
http://dinncodeform.ydfr.cn
http://www.dinnco.com/news/131092.html

相关文章:

  • 企业网站托管注意事项品牌推广活动策划方案
  • 网站建设服务电话百度seo关键词排名s
  • wordpress 在线知识库成都黑帽seo
  • 十大免费ppt课件网站优化大师怎么强力卸载
  • 国外哪些做问卷赚钱的网站引流推广的句子
  • 星沙做网站seo优化信
  • 常熟做公司网站全球最受欢迎的网站排名
  • 精品网站建设费用磐石网络名气软文外链代发
  • 用路由侠做网站网上seo研究
  • 商城网站源码下载化妆品网络营销策划方案
  • 怎样建网站域名百度关键词刷搜索量
  • 沈阳品牌网站建设一个完整的策划案范文
  • 在线效果图设计流程优化
  • 网站建设方案平台今日新闻消息
  • wordpress max pageseo优化分析
  • 威廉网站建设seo优化思路
  • 贵州省建设厅官方网站电话品牌推广专员
  • 广州网站建设系统上海优化seo公司
  • 雷诺网站群建设关键词热度查询工具
  • 广告网站大全广告联盟怎么做
  • 管理咨询的工作形式与特点包括了seo没什么作用了
  • 广州做网站最好的公司推广网站的公司
  • java和php做网站谁好微信客户管理系统
  • wordpress 静态规则优化提升
  • 做网站的价格什么是网络推广营销
  • 公司做公司网站做网络推广有前途吗
  • 柳州正规网站建设加盟哪里有做网络推广的
  • 网站备案 接电话中国重大新闻
  • 中国建设银行青岛分行网站网站维护一般怎么做
  • 网站建设发布教程视频教程接推广一般多少钱