package com.jt;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value="/FirstControl")
public class HelloControl {
    @RequestMapping(value="/hasHead",headers={"context-type=text/plain","context-type=text/html"})
    @ResponseBody
    public String headType1(){
        return "headType";
    }
    
    @RequestMapping(value="/hasnotHead")
    @ResponseBody
    public String headType2(){
        return "headType";
    }
    
}

效果1

Spring MVC-从零开始-@RequestMapping 注解headers 属性


效果2

 

Spring MVC-从零开始-@RequestMapping 注解headers 属性

 

相关文章:

  • 2021-07-26
  • 2021-12-30
  • 2021-06-06
  • 2021-04-02
  • 2018-05-17
  • 2021-12-04
  • 2021-09-29
猜你喜欢
  • 2021-09-23
  • 2021-07-17
  • 2022-03-09
  • 2022-12-23
  • 2021-06-01
  • 2021-07-19
  • 2021-08-07
相关资源
相似解决方案