お世話になります。
DBから取得したList型データをThymeleafに渡し、
Thymeleaf内で、foreachを回して値を表示させています。
その値をmessages.propertiesに定義して多言語化したいのですが、
一つ一つの値にユニークな変数名が割り振られていないため、
どのようにしてmessages.propertiesに定義していいのかがわかりません。
ControllerでList内から値を取り出して、
一つずつThymeleafに渡せば解決する話だと思うのですが、
それは避けたいと思っています。
ご教示いただければ幸いです。
<select class="form-control" id="selectcomment" name="selectcomment"> <option value="" disabled selected th:utext="#{default_selected_selectcomment}"></option> <option th:selected="${form.selectcomment} == ${selectcomment.id}" th:value="${selectcomment.id}" th:each="selectcomment : ${selectcomments}" th:field="*{selectcomment}" th:errorclass="fieldError" th:text="${selectcomment.value}"></option> </select>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/29 12:00
退会済みユーザー
2018/03/29 12:04
2018/03/29 13:24 編集
退会済みユーザー
2018/03/29 13:32
2018/03/29 14:10
2018/03/29 14:44