###前提・実現したいこと
SpringToolSuiteにて、src/main/resources/templates/test/xxx.htmlの表示方法について。
ご教授の方をよろしくお願いします。
http://localhost:8080/hellow にアクセスした時、以下のように表示したいです。
Hellow World
###現在以下のように表示されてしまっています。
test/hellow
###ソース
①../src/main/java/com/example/HelloController.java
@RestController
public class HelloController {
@RequestMapping("/hellow")
public String hello(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) {
model.addAttribute("name", name);
return "test/hellow";
}
}
②../src/main/resources/templates/test/hellow.html
③pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
###実行方法
①demo プロジェクト部分で、Maven Install
②実行 > Spring Bootアプリケーション
③http://localhost:8080/hellow
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/15 09:02