![](/img/trans.png)
[英]How to fetch parameters from the application.properties file for a test case
[英]How to store array of values in application.properties file and fetch it to display them in a thyme leaf template
我想在应用程序属性文件中存储血型列表,以便在要求用户选择血型时可以将其获取并显示在下拉列表中。 我正在使用百里香叶模板引擎。 我想用它来尽可能避免硬编码(用于学习经验)。 有任何想法吗?
血型=A+,B+,AB+
@Value("${bloodGroups}") private String[] bloodGroups;
model.addAttribute("bloodGroups", bloodGroups);
<select required="true" name="bloodGroup" id="bloodGroup"> <option th:selected/> <option th:each="bloodGroup: ${bloodGroups}" th:value="${bloodGroup}" th:text="${bloodGroup}"></option> </select>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.