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?

thymeleaf : TemplateInputException でハマった件_変数定義編

Posted at

背景

JUNITでControlelerのテストをしている際、以下の事象に遭遇した。

エラーログ

Caused by: org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/******.html]" - line 263, col 30)
Caused by: org.attoparser.ParseException: (Line = 263, Column = 30) Malformed markup: Attribute "th:with" appears more than once in element

要は、Thymeleafの書き方がいけなかったっぽい。。

エラーが発生した箇所

divタグ内で使用する変数を「th:with」で定義したのだが、1つにまとめないといけないらしい。(まあ確かにそうか笑)

エラーが出た箇所
<div class="inner"
   th:with="isWorking = ${applyDetailViewDto.entryResume.isWorking}"
   th:with="jobChangeCount = ${applyDetailViewDto.entryResume.jobChangeCount}">

修正後

修正後のソース
<div class="inner" 
    th:with="isWorking = ${applyDetailViewDto.entryResume.isWorking}, 
        jobChangeCount = ${applyDetailViewDto.entryResume.jobChangeCount}">

これでOK!

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?