一般社団法人 全国個人事業主支援協会

COLUMN コラム

  • Thymeleaf その3

Thymeleafその2の続き

◯th:each
th:each属性は、リストや配列を反復処理するために使用されます。例:

<ul>
<li th:each=”item : ${items}” th:text=”${item.name}”>Item Name</li>
</ul>
このコードでは、itemsリストの各要素について<li>タグを生成します。

◯th:href / th:src
th:href属性はリンク先のURLを動的に設定し、th:src属性は画像のソースURLを動的に設定します。例:

<a th:href=”@{/profile/${user.id}}”>Profile</a>
<img th:src=”@{/images/${image.name}.jpg}” alt=”Image”/>

The following two tabs change content below.

S, M

最新記事 by S, M (全て見る)

この記事をシェアする

  • Twitterでシェア
  • Facebookでシェア
  • LINEでシェア