controller中返回值是string

指定返回的视图页面名称,结合设置的返回地址路径加上页面名称后缀即可访问到。
注意:如果方法声明了注解@ResponseBody ,则会直接将返回值输出到页面。

@RequestMapping(value="/showdog")
    public String hello1(){
        return "hello";
    }
@RequestMapping(value="/print")
    @ResponseBody
    public String print(){
        String message = "Hello World, Spring MVC!";
        return message;
    }

posted @ 2019-06-27 01:08  我差两天十八岁  阅读(1629)  评论(0编辑  收藏  举报