Thymeleaf Layout Dialectのth:withに関するエラー

バグなのか仕様変更なのか後で調べるためのメモ。バージョンアップ後から下記のような使い方するとエラーが発生する様になった。

1
2
3
4
5
6
user.html
    xmlns:th="http://www.thymeleaf.org"
    layout:decorate="~{templates/layout}"
    th:with="currentMenu = ${param.from} != null and ${param.from[0]} == 'list' ? 'admin' : 'userSaveForm'">
1
2
3
4
5
6
layout.html
    xmlns:th="http://www.thymeleaf.org"
    th:with="lang = ${#locale.language}"
    th:lang="${#locale.language}">
1
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as assignation sequence: "currentMenu=(((${param.from} !,lang=${#locale.language}" (template: "templates/layout" - line 5, col 5)

user.htmlのth:withを単純な代入式にすると、エラーにならない。

1
th:with="currentMenu = 'admin'"

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です