2016-04-27 73 views
1

我有以下代碼,我相信我需要在百里香中逃脫。如何擺脫百里香雙引號?

th:required="" 

它引發以下錯誤:

org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: ""

有什麼建議?

回答

2

問題不是你需要逃跑,而是你需要一個表達式,Thymeleaf可以解釋爲真或假。 th:required="${expression}"告訴它包含required屬性,如果expression爲真,則不然。如果您想無條件包含它,請刪除Thymeleaf名稱空間,並只包含一個普通的required="required"