2017-08-14 56 views
0

我正在顯示如下的表格內容。尤其要注意如何*{id}自動映射到row內容:如何訪問百里香塊中的物體?

<table> 
    <tbody> 
    <th:block th:each="row : ${content}"> 
     <tr th:object="${row}"> 
      <td th:text="*{id}/> 
      <td th:text="${#temporals.format(row.thedate, 'yyyy-MM-dd HH:mm:ss')}"> 
       2017-08-07 20:01:52</td> 
     </tr> 
    </th:block> 
    </tbody> 
</table> 

問:我怎麼可以重寫#temporals表達也使用隱式引用到行?例如,下列不起作用:

<td th:text="${#temporals.format(*{thedate}, 'yyyy-MM-dd HH:mm:ss')}"> 

爲什麼*{thedate}表達式在這裏不起作用?

+0

你嘗試'日:with'? –

+0

'th:with =「withdate = * {thedate}」'確實有效,但我希望在沒有'th:with'的情況下也能達到同樣的效果。 – membersound

回答