質問編集履歴

1

質問追記

2019/07/30 05:04

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -114,10 +114,6 @@
114
114
 
115
115
  </tr>
116
116
 
117
-
118
-
119
-
120
-
121
117
  <tr th:each="strength : ${strength}">
122
118
 
123
119
  <td align="left" th:text="${strength.st_id}"></td>
@@ -136,8 +132,6 @@
136
132
 
137
133
  th:inline="text">[[${strength.strength}]]
138
134
 
139
-
140
-
141
135
  </option>
142
136
 
143
137
  </select>
@@ -168,6 +162,82 @@
168
162
 
169
163
  ![イメージ説明](bae9c8727fcf40208ad8a9964eeb89b0.png)
170
164
 
165
+
166
+
167
+ ご指摘のとおり重複IDを下記のとおり変更したところDBの初期値を表示させることが出来ました。
168
+
169
+ ```html
170
+
171
+ <!DOCTYPE html>
172
+
173
+ <html xmlns:th="http://www.thymeleaf.org">
174
+
175
+ <head>
176
+
177
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
178
+
179
+ <title>test</title>
180
+
181
+ <link rel="stylesheet" type="text/css" href="master.css" />
182
+
183
+ </head>
184
+
185
+ <body>
186
+
187
+ <table id="t_strength"
188
+
189
+ class="table table-striped table-bordered table-hover table-condensed">
190
+
191
+ <tr>
192
+
193
+ <th>No.</th>
194
+
195
+ <th>列1</th>
196
+
197
+ </tr>
198
+
199
+ <tr th:each="strength : ${strength}">
200
+
201
+ <td align="left" th:text="${strength.st_id}"></td>
202
+
203
+ <td align="left">
204
+
205
+ <div>
206
+
207
+ <select id="st_Id" name="Strength">
208
+
209
+ <option th:each="Strength : ${st_id}" th:value="${strength.st_id}"
210
+
211
+ th:selected="${strength.st_id == st_Id}" th:inline="text">[[${strength.strength}]]
212
+
213
+ </option>
214
+
215
+ </select>
216
+
217
+ </div>
218
+
219
+ </td>
220
+
221
+ </tr>
222
+
223
+ </table>
224
+
225
+ </body>
226
+
227
+ </html>
228
+
229
+ ```
230
+
231
+ しかし、ドロップダウンすると以下のようにその値一色(リスト内が同じ値)になってしまいます。
232
+
233
+ ![イメージ説明](4bb144673183283f76a2ea921daf6729.png)
234
+
235
+ 表示(初期値)は現在のDBの値とするけれど、変更可能なようにドロップダウン自体リスト表示は可能でしょうか?
236
+
237
+
238
+
239
+
240
+
171
241
  ### 補足情報(FW/ツールのバージョンなど)
172
242
 
173
243
  java spring boot