0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

IntelliJのSpring boot + Thymeleafで変数を参照できない

Last updated at Posted at 2020-04-17

IntelliJでコントローラからHTML(Thymeleaf) に渡した変数に警告文が出ているためこれを解決
model.addAttribute("title", "ユーザ一覧");←Controllerのこの子
screenshot.14.jpg

確認1

xmlns:th="http://www.thymeleaf.org" で名前空間を宣言しているか

test.html
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
︙
︙
(省略)

確認2

IntelliJで必要なプラグインがインストールされているか
Ctrl + Alt + SでSetting画面を表示Pluginで
Thymeleaf + Spring関係がインストールされているか確認する
自分の場合Spring MVCがインストールされていなかったため警告文が表示されていた。
screenshot.23.jpg

これでHTMLからコントローラまで一気に飛べるようになった!
やったぜ\(^o^)/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?