質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Thymeleaf

Thymeleaf(タイムリーフ)とは、Java用のテンプレートエンジンで、特定のフレームワークに依存せず使用することが可能です。

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

Q&A

解決済

1回答

4690閲覧

Thymeleafのエラー

tarou124

総合スコア2

Thymeleaf

Thymeleaf(タイムリーフ)とは、Java用のテンプレートエンジンで、特定のフレームワークに依存せず使用することが可能です。

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

0グッド

0クリップ

投稿2021/08/16 04:52

初心者です。SpringBoot2でtomcat起動し画面遷移すると以下のエラーとなってしまいます。
なんとなく、htmlが悪そう、というところまでわかっているのですが、
ここからどう見ていったらよいかわからず。。

気になる点として、Springbootを1系→2系にあげたタイミングで
thymeleafのバージョンをあげる必要がありそう、とみたので、
pom.xmlではthymeleafのバージョン3を指定していますがそれ以外の対応はしていないです。

htmlの書き換えが必要になったりするのでしょうか?
また、その場合、何を頼りに修正していったらよいでしょうか?

ログは文字数制限で全文のせられないため、部分的に抜粋しています。

2021-08-16 13:14:18.530 [http-nio-8080-exec-2] ERROR org.thymeleaf.TemplateEngine - [THYMELEAF][http-nio-8080-exec-2] Exception processing template "xxxx/xxxx/list": An error happened during template parsing (template: "class path resource [templates/xxxx/xxxx/list.html]") org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/xxxx/xxxx/list.html]") at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:241) at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) ・ ・ ・ Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "#helper.testxxxxx(info.serviceStatus)" (template: "xxxx/xxxx/list" - line 31, col 12) ・ ・ Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#helper.testxxxxx(info.serviceStatus)" (template: "xxxx/xxxx/list" - line 31, col 12) ・ ・ Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call method testxxxxx(java.lang.String) on null context object ・ ・ 2021-08-16 13:14:18.536 [http-nio-8080-exec-2] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/xxxx/xxxx/list.html]")] with root cause org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call method testxxxxx(java.lang.String) on null context object ・ ・

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

m.ts10806

2021/08/16 04:57

ログだけ載せられても「エラーの通りなんでしょうね」としか言いようがありません。
m.ts10806

2021/08/16 05:01

他者が再現できる情報を提示してください。pom.xmlも含めて全てです。 あまりに長くなるようでしたら再現できそうな最小構成のコードを改めて組みなおして提示してください。 https://teratail.com/help/question-tips 問題切り分けもできます。
tarou124

2021/08/16 09:47

申し訳ありません。お手数をおかけしました。
tarou124

2021/08/16 10:21

すみません。回答を追記してみました。
guest

回答1

0

自己解決

pom.xmlのバージョン指定に誤りがございました。

後半2行を追記したところ解決しました。

<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>11</java.version> <thymeleaf.version>3.0.9.RELEASE</thymeleaf.version> <thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version> </properties>

投稿2021/08/16 09:47

編集2021/08/16 10:22
tarou124

総合スコア2

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

shinami

2021/08/16 11:15

Thymeleafのそのバージョンを使う必要が特にない場合Thymeleaf関連のpom.xmlは、 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> だけでも動くと思います。例えばSpringBoot2.5.0を使う場合 https://github.com/spring-projects/spring-boot/blob/v2.5.0/spring-boot-project/spring-boot-dependencies/build.gradle の1754行にThymeleaf", "3.0.12.RELEASE"とあるのでそのバージョンが使われる事になります。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問