Spring Boot/View/Thymeleaf/コントローラーから呼び出す

Spring Boot/View/Thymeleaf/コントローラーから呼び出す

基本

Controller アノテーションをつけたクラスから String をリターンすることにして、 そのパス指定が src/main/resources/templates 以下に合致するもの .html のファイルが呼び出される。

@Controller
@RequestMapping("/sample01")
public class Sample01Controller {
    @RequestMapping("/")
    public String index() {
        return "sample01/index";
    }
}

この場合なら src/main/resources/templates/sample01/index.html が呼び出される。

java/spring/spring_boot/view/thymeleaf/call_from_controller.txt · 最終更新: 2021-06-25 12:27 by ore