コントローラから画面を渡す場合は
model.addAttribute("パラメータ名", "渡したい値");
のメソッドを使う。
package com.example.demo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class DemoController {
  // アクセスする際に使用するURLを設定
  @RequestMapping("/demo")
  public String demo(Model model) {
    // "message"という変数に「Hello world」という文字列を設定
    model.addAttribute("message", "Hello world");
    // 返却するテンプレートファイル名を指定
    return "demo";
  }
}画面側はまず、Thymeleafタグの宣言を行い、
<html xmlns:th="http://www.thymeleaf.org">
表示したい場所に、Thymeleafのth:textタグを使うことで値が表示できる。
<!DOCTYPE html>
<!-- Thymeleafで使用するthタグを認識するための記述 -->
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>Hello world</title>
</head>
<body>
  <!-- "message"という変数の値を表示する -->
  <h1 th:text="${message}"></h1>
</body>
</html>http://localhost:8080/demo にアクセス

パラメータの受け渡しができました。
  
  
  
  
    




    
    




