@RequestMapping("/")
    public void welcomeHandler() {
    }
这个/是什么意思呢?

解决方案 »

  1.   

    那通过什么路径访问呢,,
    http://localhost:8080/abc/
    这样的路径访问index.jsp了
      

  2.   

    You can narrow the primary mapping by specifying a list of consumable media types. The request will be matched only if the Content-Type request header matches the specified media type. For example:@Controller
    @RequestMapping(value = "/pets", method = RequestMethod.POST, consumes="application/json")
    public void addPet(@RequestBody Pet pet, Model model) {    
        // implementation omitted
    }这个解释是什么意思呢??大体是消费指定的contentType类型,????
      

  3.   

    只接受contentType=application/json的请求
      

  4.   

    @RequestMapping(value = "/pets", method = RequestMethod.POST, consumes="application/json")默认访问路径为 http://localhost://projectname/pets.do  ,当然你的可能不一样
    接受POST类型的请求,不接收GET类型的请求,如果不指定method,那么POST和GET都是可以接受的
    @RequestBody 表示返回类型为JSON
      

  5.   


    @RequestBody 表示接受的参数是json类型。 它会自动帮你转换成Pet对象
    @ResponseBody 表示返回类型为JSON
      

  6.   

    那如何才能确定接收的是JSON类型呢??http传的都是字符串呀,,abc和{a:'abc'}能自动区分?