循环视图路径错误,Spring MVC

2024-03-02

我正在尝试做教程 ->http://spring.io/guides/gs/serving-web-content/ http://spring.io/guides/gs/serving-web-content/

当我运行它时,它显示圆形视图路径[问候],为什么?

在本教程中,我不明白的一件事是以下内容的作用及其工作原理:

return "greeting";

代码片段:

package hello;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class GreetingController {
    @RequestMapping("/greeting")
    public String greeting(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) {
        model.addAttribute("name", name);
        return "greeting";
    }
}

检查 .pom 中的依赖项是否有

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

循环视图路径错误,Spring MVC 的相关文章

随机推荐