{"id":6435,"date":"2026-06-13T14:47:26","date_gmt":"2026-06-13T05:47:26","guid":{"rendered":"https:\/\/route-zero.com\/recruit\/?post_type=route&#038;p=6435"},"modified":"2026-10-13T14:47:31","modified_gmt":"2026-10-13T05:47:31","slug":"thymeleaf-th-each-index-status","status":"publish","type":"route","link":"https:\/\/route-zero.com\/recruit\/route\/6435\/","title":{"rendered":"Thymeleaf\u306eth:each\u3067index\u3092\u53d6\u5f97\uff5cstatus\u5909\u6570\u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"<p>Thymeleaf\u306e`th:each`\u3067\u884c\u756a\u53f7\u3084index\u3092\u4f7f\u3044\u305f\u3044\u3068\u304d\u306f\u3001\u53cd\u5fa9\u5909\u6570\u306e\u5f8c\u308d\u306b**status\u5909\u6570**\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002`th:each=&quot;user, stat : ${users}&quot;`\u3068\u66f8\u3051\u3070\u3001`stat.index`\u306f0\u59cb\u307e\u308a\u3001`stat.count`\u306f1\u59cb\u307e\u308a\u3067\u3059\u3002\u753b\u9762\u306b\u300c1\u30012\u30013\u2026\u300d\u3068\u884c\u756a\u53f7\u3092\u51fa\u3059\u306a\u3089`count`\u30010-based\u306e\u4f4d\u7f6e\u304c\u5fc5\u8981\u306a\u3089`index`\u3092\u4f7f\u3046\u3001\u3068\u899a\u3048\u308b\u3068\u8ff7\u3044\u307e\u305b\u3093\u3002<\/p>\n<h2>\u6700\u521d\u306b\u6574\u7406\uff1aindex\u306f0\u59cb\u307e\u308a\u3001count\u306f1\u59cb\u307e\u308a<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u30d7\u30ed\u30d1\u30c6\u30a3<\/th>\n<th>\u610f\u5473<\/th>\n<th>\u3088\u304f\u4f7f\u3046\u5834\u9762<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>stat.index<\/td>\n<td>0\u304b\u3089\u59cb\u307e\u308b\u73fe\u5728\u4f4d\u7f6e<\/td>\n<td>0-based\u4f4d\u7f6e\u304c\u5fc5\u8981\u306a\u51e6\u7406<\/td>\n<\/tr>\n<tr>\n<td>stat.count<\/td>\n<td>1\u304b\u3089\u59cb\u307e\u308b\u73fe\u5728\u4f4d\u7f6e<\/td>\n<td>\u753b\u9762\u306e\u884c\u756a\u53f7\u30fb\u9023\u756a\u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td>stat.size<\/td>\n<td>\u7dcf\u8981\u7d20\u6570<\/td>\n<td>\u73fe\u5728\u4f4d\u7f6e \/ \u7dcf\u4ef6\u6570\u306e\u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td>stat.current<\/td>\n<td>\u73fe\u5728\u306e\u53cd\u5fa9\u8981\u7d20<\/td>\n<td>status\u5074\u304b\u3089\u73fe\u5728\u8981\u7d20\u3092\u53c2\u7167<\/td>\n<\/tr>\n<tr>\n<td>stat.even \/ stat.odd<\/td>\n<td>\u73fe\u5728\u306e\u53cd\u5fa9\u304c\u5076\u6570\u304b\u5947\u6570\u304b<\/td>\n<td>\u4ea4\u4e92\u306eCSS\u30af\u30e9\u30b9\u3084\u8868\u793a\u6761\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>stat.first<\/td>\n<td>\u6700\u521d\u306e\u8981\u7d20\u304b<\/td>\n<td>\u5148\u982d\u3060\u3051\u8868\u793a\u3092\u5909\u3048\u308b<\/td>\n<\/tr>\n<tr>\n<td>stat.last<\/td>\n<td>\u6700\u5f8c\u306e\u8981\u7d20\u304b<\/td>\n<td>\u672b\u5c3e\u3060\u3051\u8868\u793a\u3092\u5909\u3048\u308b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Thymeleaf 3.1.5\u306e\u516c\u5f0f\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001status\u5909\u6570\u306b`index`\u3001`count`\u3001`size`\u3001`current`\u3001`even\/odd`\u3001`first`\u3001`last`\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002status\u5909\u6570\u306f\u53cd\u5fa9\u5909\u6570\u306e\u5f8c\u308d\u3078\u30ab\u30f3\u30de\u533a\u5207\u308a\u3067\u5b9a\u7fa9\u3057\u3001`th:each`\u3092\u6301\u3064\u8981\u7d20\u3068\u305d\u306e\u5185\u90e8\u3067\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<blockquote>\n<p><strong>\u7528\u8a9e\u89e3\u8aac\uff1astatus\u5909\u6570<\/strong><br \/>th:each\u306e\u73fe\u5728\u4f4d\u7f6e\u3084\u7dcf\u4ef6\u6570\u3001\u5076\u5947\u3001\u5148\u982d\u30fb\u672b\u5c3e\u306a\u3069\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u72b6\u614b\u3092\u4fdd\u6301\u3059\u308b\u5909\u6570\u3067\u3059\u3002<\/p>\n<\/blockquote>\n<hr>\n<h2>\u8868\u306b1\u59cb\u307e\u308a\u306e\u884c\u756a\u53f7\u3092\u8868\u793a\u3059\u308b<\/h2>\n<p>\u4e00\u89a7\u8868\u3067\u5229\u7528\u8005\u306b\u898b\u305b\u308b\u884c\u756a\u53f7\u306a\u3089\u30010\u59cb\u307e\u308a\u306e`index`\u3088\u308a1\u59cb\u307e\u308a\u306e`count`\u304c\u81ea\u7136\u3067\u3059\u3002<\/p>\n<pre><code>&lt;table&gt;\r\n  &lt;tr th:each=&quot;user, stat : ${users}&quot;&gt;\r\n    &lt;td th:text=&quot;${stat.count}&quot;&gt;1&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${user.name}&quot;&gt;\u5c71\u7530&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;<\/code><\/pre>\n<p>1\u4ef6\u76ee\u3067\u306f`stat.index`\u304c0\u3001`stat.count`\u304c1\u3067\u3059\u3002\u8868\u793a\u4e0a\u306e\u9023\u756a\u30680-based\u4f4d\u7f6e\u3092\u6df7\u540c\u3057\u306a\u3044\u3053\u3068\u304c\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002<\/p>\n<hr>\n<h2>index\u3092\u4f7f\u3046\u306e\u306f0-based\u306e\u4f4d\u7f6e\u304c\u5fc5\u8981\u306a\u3068\u304d<\/h2>\n<p>`index`\u306f\u73fe\u5728\u306e\u8981\u7d20\u304c\u4f55\u756a\u76ee\u304b\u30920\u304b\u3089\u6570\u3048\u307e\u3059\u30020-based\u306e\u6dfb\u5b57\u3068\u5bfe\u5fdc\u3055\u305b\u305f\u3044\u5834\u5408\u306a\u3069\u3001\u4f4d\u7f6e\u305d\u306e\u3082\u306e\u30920\u59cb\u307e\u308a\u3067\u6271\u3046\u76ee\u7684\u306b\u5411\u304d\u307e\u3059\u3002<\/p>\n<pre><code>&lt;ul&gt;\r\n  &lt;li th:each=&quot;item, stat : ${items}&quot;&gt;\r\n    &lt;span th:text=&quot;${stat.index}&quot;&gt;0&lt;\/span&gt;\r\n    &lt;span th:text=&quot;${item.name}&quot;&gt;Item&lt;\/span&gt;\r\n  &lt;\/li&gt;\r\n&lt;\/ul&gt;<\/code><\/pre>\n<hr>\n<h2>even\u30fbodd\u3067\u4ea4\u4e92\u306e\u30af\u30e9\u30b9\u3092\u4ed8\u3051\u308b<\/h2>\n<p>status\u5909\u6570\u306b\u306f\u5076\u6570\u30fb\u5947\u6570\u3092\u5224\u5b9a\u3059\u308b`even`\u3068`odd`\u3082\u3042\u308a\u307e\u3059\u3002\u884c\u3054\u3068\u306b\u30af\u30e9\u30b9\u3092\u5207\u308a\u66ff\u3048\u305f\u3044\u5834\u5408\u3001Controller\u5074\u3067\u30d5\u30e9\u30b0\u3092\u4f5c\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre><code>&lt;tr th:each=&quot;user, stat : ${users}&quot;\r\n    th:classappend=&quot;${stat.odd} ? &#39;row-odd&#39; : &#39;row-even&#39;&quot;&gt;\r\n  &lt;td th:text=&quot;${stat.count}&quot;&gt;1&lt;\/td&gt;\r\n  &lt;td th:text=&quot;${user.name}&quot;&gt;\u5c71\u7530&lt;\/td&gt;\r\n&lt;\/tr&gt;<\/code><\/pre>\n<h2>first\u30fblast\u3067\u5148\u982d\u3068\u672b\u5c3e\u3060\u3051\u8868\u793a\u3092\u5909\u3048\u308b<\/h2>\n<pre><code>&lt;div th:each=&quot;item, stat : ${items}&quot;&gt;\r\n  &lt;span th:if=&quot;${stat.first}&quot;&gt;\u5148\u982d&lt;\/span&gt;\r\n  &lt;span th:text=&quot;${item.name}&quot;&gt;Item&lt;\/span&gt;\r\n  &lt;span th:if=&quot;${stat.last}&quot;&gt;\u672b\u5c3e&lt;\/span&gt;\r\n&lt;\/div&gt;<\/code><\/pre>\n<p>`first`\u3068`last`\u306f\u3001\u73fe\u5728\u306e\u53cd\u5fa9\u304c\u6700\u521d\u30fb\u6700\u5f8c\u304b\u3092\u771f\u507d\u5024\u3067\u8fd4\u3057\u307e\u3059\u3002\u5148\u982d\u3084\u672b\u5c3e\u3060\u3051\u6ce8\u8a18\u3092\u51fa\u3059\u8868\u793a\u306b\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<h2>size\u30fbcurrent\u3068\u6697\u9ed9\u306eStat\u5909\u6570<\/h2>\n<p>\u7dcf\u4ef6\u6570\u306f`size`\u3001\u73fe\u5728\u306e\u53cd\u5fa9\u8981\u7d20\u306f`current`\u3067\u3059\u3002\u307e\u305fstatus\u5909\u6570\u3092\u660e\u793a\u3057\u306a\u3044\u5834\u5408\u3001Thymeleaf\u306f\u53cd\u5fa9\u5909\u6570\u540d\u306e\u672b\u5c3e\u3078`Stat`\u3092\u4ed8\u3051\u305f\u5909\u6570\u3092\u81ea\u52d5\u4f5c\u6210\u3057\u307e\u3059\u3002`user`\u306a\u3089`userStat`\u3067\u3059\u3002<\/p>\n<pre><code>&lt;ul&gt;\r\n  &lt;li th:each=&quot;user : ${users}&quot;&gt;\r\n    &lt;span th:text=&quot;${userStat.count + &#39; \/ &#39; + userStat.size}&quot;&gt;1 \/ 3&lt;\/span&gt;\r\n    &lt;span th:text=&quot;${user.name}&quot;&gt;\u5c71\u7530&lt;\/span&gt;\r\n  &lt;\/li&gt;\r\n&lt;\/ul&gt;<\/code><\/pre>\n<p>\u77ed\u3044\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u306f\u4fbf\u5229\u3067\u3059\u304c\u3001\u30cd\u30b9\u30c8\u3057\u305f\u7e70\u308a\u8fd4\u3057\u3067\u306f\u660e\u793a\u7684\u306astatus\u5909\u6570\u540d\u3092\u4ed8\u3051\u305f\u65b9\u304c\u8ffd\u3044\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30cd\u30b9\u30c8\u3057\u305fth:each\u3067\u306fstatus\u5909\u6570\u540d\u3092\u5206\u3051\u308b<\/h2>\n<pre><code>&lt;section th:each=&quot;category, categoryStat : ${categories}&quot;&gt;\r\n  &lt;h2 th:text=&quot;${category.name}&quot;&gt;Category&lt;\/h2&gt;\r\n  &lt;ul&gt;\r\n    &lt;li th:each=&quot;item, itemStat : ${category.items}&quot;&gt;\r\n      &lt;span th:text=&quot;${categoryStat.count}&quot;&gt;1&lt;\/span&gt;\r\n      &lt;span th:text=&quot;${itemStat.count}&quot;&gt;1&lt;\/span&gt;\r\n      &lt;span th:text=&quot;${item.name}&quot;&gt;Item&lt;\/span&gt;\r\n    &lt;\/li&gt;\r\n  &lt;\/ul&gt;\r\n&lt;\/section&gt;<\/code><\/pre>\n<p>\u5916\u5074\u3068\u5185\u5074\u3067`categoryStat`\u3001`itemStat`\u306e\u3088\u3046\u306b\u5225\u540d\u3092\u4ed8\u3051\u308b\u3068\u3001\u3069\u3061\u3089\u306eindex\/count\u3092\u53c2\u7167\u3057\u3066\u3044\u308b\u304b\u660e\u78ba\u3067\u3059\u3002<\/p>\n<h2>Thymeleaf\u306e\u57fa\u672c\u69cb\u6587\u3068\u5f0f\u3092\u4e00\u7dd2\u306b\u78ba\u8a8d\u3059\u308b<\/h2>\n<p>`th:each`\u4ee5\u5916\u306e\u57fa\u672c\u69cb\u6587\u3082\u307e\u3068\u3081\u3066\u78ba\u8a8d\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u65e2\u5b58\u306eThymeleaf\u5165\u9580\u8a18\u4e8b\u304c\u88dc\u52a9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\uff08Thymeleaf\u306e\u57fa\u672c\u69cb\u6587\u5168\u4f53\u306b\u3064\u3044\u3066\u306f\u300e<a href=\"https:\/\/route-zero.com\/recruit\/route\/1471\/\">Thymeleaf\u5165\u9580\u2502Spring Boot\u306710\u5206\u5b9f\u8df5\u30b5\u30f3\u30d7\u30eb5\u9078<\/a>\u300f\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>\uff08Thymeleaf\u5f0f\u306e\u8a18\u53f7\u306e\u9055\u3044\u306b\u3064\u3044\u3066\u306f\u300e<a href=\"https:\/\/route-zero.com\/recruit\/route\/1132\/\">Thymeleaf\u3067\u300c$\u300d\u300c@\u300d\u300c*\u300d\u306f\u3069\u3046\u9055\u3046\uff1f\u521d\u5fc3\u8005\u3067\u3082\u308f\u304b\u308b\u4f7f\u3044\u5206\u3051\u5b8c\u5168\u30ac\u30a4\u30c9<\/a>\u300f\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\uff09<\/p>\n<h2>\u3088\u304f\u3042\u308b\u8cea\u554f<\/h2>\n<h3>\u884c\u756a\u53f7\u30921\u304b\u3089\u8868\u793a\u3057\u305f\u3044\u5834\u5408\u306findex + 1\u3067\u3082\u3088\u3044\u3067\u3059\u304b\uff1f<\/h3>\n<p>\u8868\u793a\u7d50\u679c\u3068\u3057\u3066\u306f\u4f5c\u308c\u307e\u3059\u304c\u3001Thymeleaf\u306b\u306f1\u59cb\u307e\u308a\u306e`count`\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u5358\u7d14\u306a\u884c\u756a\u53f7\u306a\u3089`stat.count`\u306e\u65b9\u304c\u610f\u56f3\u3092\u76f4\u63a5\u8868\u305b\u307e\u3059\u3002<\/p>\n<h3>status\u5909\u6570\u3092\u5fc5\u305a\u5ba3\u8a00\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u304b\uff1f<\/h3>\n<p>\u5fc5\u9808\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u660e\u793a\u3057\u306a\u3044\u5834\u5408\u306f\u53cd\u5fa9\u5909\u6570\u540d\u306b`Stat`\u3092\u4ed8\u3051\u305f\u6697\u9ed9\u306estatus\u5909\u6570\u304c\u4f5c\u3089\u308c\u307e\u3059\u3002<\/p>\n<h3>index\u3068count\u306f\u4f55\u304c\u9055\u3044\u307e\u3059\u304b\uff1f<\/h3>\n<p>`index`\u306f0\u59cb\u307e\u308a\u3001`count`\u306f1\u59cb\u307e\u308a\u3067\u3059\u30020-based\u4f4d\u7f6e\u304c\u5fc5\u8981\u306a\u3089index\u3001\u753b\u9762\u4e0a\u306e\u9023\u756a\u306a\u3089count\u304c\u5206\u304b\u308a\u3084\u3059\u3044\u9078\u629e\u3067\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081\uff1a\u8868\u793a\u884c\u756a\u53f7\u306fcount\u30010-based\u4f4d\u7f6e\u306findex<\/h2>\n<ul>\n<li>`stat.index`\u306f0\u59cb\u307e\u308a\u3001`stat.count`\u306f1\u59cb\u307e\u308a<\/li>\n<li>\u884c\u756a\u53f7\u8868\u793a\u306a\u3089count\u30010-based\u4f4d\u7f6e\u306a\u3089index\u3092\u4f7f\u3046<\/li>\n<li>size\/current\/even\/odd\/first\/last\u3082\u540c\u3058status\u5909\u6570\u304b\u3089\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<li>status\u5909\u6570\u3092\u7701\u7565\u3059\u308b\u3068\u53cd\u5fa9\u5909\u6570\u540d + Stat\u304c\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b<\/li>\n<li>\u30cd\u30b9\u30c8\u3057\u305f\u30eb\u30fc\u30d7\u3067\u306fstatus\u5909\u6570\u540d\u3092\u5206\u3051\u308b<\/li>\n<\/ul>\n<p>\u307e\u305a\u624b\u5143\u306e`th:each`\u3078`, stat`\u3092\u8ffd\u52a0\u3057\u3001\u884c\u756a\u53f7\u306a\u3089`stat.count`\u3001\u4f4d\u7f6e\u78ba\u8a8d\u306a\u3089`stat.index`\u3092\u8868\u793a\u3057\u3066\u6319\u52d5\u3092\u78ba\u304b\u3081\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"featured_media":6445,"template":"","meta":{"ssp_meta_title":"Thymeleaf th:each\u306eindex\u53d6\u5f97\uff5cstatus\u5909\u6570\u3092\u5b9f\u4f8b\u3067\u89e3\u8aac","ssp_meta_description":"Thymeleaf\u306eth:each\u3067index\u3084\u884c\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3002status\u5909\u6570\u306eindex\u30fbcount\u30fbsize\u30fbeven\/odd\u30fbfirst\/last\u3001\u6697\u9ed9\u306eStat\u5909\u6570\u3001\u8868\u30fb\u30ea\u30b9\u30c8\u30fb\u30cd\u30b9\u30c8\u3057\u305f\u7e70\u308a\u8fd4\u3057\u306e\u5b9f\u4f8b\u307e\u3067\u6574\u7406\u3057\u307e\u3059\u3002","ssp_meta_keyword":"Thymeleaf th:each index \u4f7f\u3044\u65b9,Thymeleaf th:each status,Thymeleaf index count \u9055\u3044,Thymeleaf even odd,Thymeleaf first last,Thymeleaf Stat,Thymeleaf \u7e70\u308a\u8fd4\u3057 \u884c\u756a\u53f7","ssp_meta_canonical":""},"route_category":[9],"_links":{"self":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route\/6435"}],"collection":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route"}],"about":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/types\/route"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media\/6445"}],"wp:attachment":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media?parent=6435"}],"wp:term":[{"taxonomy":"route_category","embeddable":true,"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route_category?post=6435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}