春季启动restapi页面调用

时间:2020-02-18 04:37:05

标签: java rest spring-boot

我有一个简单的spring boot应用程序。我正在尝试通过rest控制器加载html文件。下面是我的文件夹结构。我无法加载test.html(就像其中的helloworld代码一样)

enter image description here

@RequestMapping("/show1")
public ModelAndView showpage1() {
    System.out.println("## show1");
    ModelAndView modelAndView = new ModelAndView();
     modelAndView.setViewName("test");
     return modelAndView;
}

我的test.html内容

<h1> hello World </h1>

2 个答案:

答案 0 :(得分:0)

尝试这样做:

 @RequestMapping("/show1")
            public String showpage1() {
                return "test";
            } 

其中test.html是您的页面

答案 1 :(得分:0)

您只需要返回带有视图名称的字符串。

=IF(DATEVALUE(N21) <= DATEVALUE(M21) +14,"Green","Yellow")