yml配置文件

maps: "{key1: 'value1', key2: 'value2'}"

 

java中

@Value("#{${maps}}")  
private LinkedHashMap maps;

 我这里之所以用LinkedHashMap类型 是因为我想要是有序的 可以根据自己的来




thymeleaf遍历
<select class="form-control" name="maps" >
    <option th:each="item,m:${map}" th:value="${m.current.key}"  th:text="${m.current.value}" required></option>
</select>

 

 

 

 






相关文章:

  • 2021-12-04
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-03-03
  • 2021-04-01
相关资源
相似解决方案