IntelliJ, Springboot_view
3565 ワード
1.controller
/helloにマッピング
package hello.helloword.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HelloController {
@GetMapping("hello")
public String hello(Model model){
model.addAttribute("data","hello");
return "hello";
}
}
return "hello";
hello.html除去レンダリング(thymeleafエンジンの処理)
2.templates/html
<!DOCTYPE HTML>
<html xmlns:th="http//www.thymeleaf.org">
<head>
<title>Hello</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<p th:text="'안녕하세요.' +${data}" >안녕하세요!!!!!</p>
</body>
</html>
${data}キーの値は「hello」です.3.成果
Reference
この問題について(IntelliJ, Springboot_view), 我々は、より多くの情報をここで見つけました https://velog.io/@dbal9357/IntelliJ-Springboot로-월컴화면띄우기テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol