Thymeleaf基础 遍历List、Map、List<map>、Map<List>
2016-12-28 10:28
441 查看
controller
@RequestMapping("/hello")public String hello(Model map){Map user= new HashMap();user.put("name", "姓名");user.put("age", "年龄");user.put("sex", "性别");user.put("birthday", "生日");user.put("phonenumber", "手机");map.addAttribute("userhead", user);List userinfo =new ArrayList();userinfo.add("周美玲");userinfo.add("32");userinfo.add("女");userinfo.add("1985");userinfo.add("19850014665");map.addAttribute("userinfo", userinfo);List outerList=new ArrayList<>();Map innerMap=new HashMap<>();for (int i = 0; i < 10; i++) {innerMap.put("1", i);innerMap.put("1", i++);i++;outerList.add(innerMap);}map.addAttribute("listmap", outerList);return "/hello";}
遍历Map 和 List
<table class="table"><thead><th th:each="userhead : ${userhead}" th:text="${userhead.key}"></th><th th:each="userhead : ${userhead}" th:text="${userhead.value}"></th></thead><tbody ><td th:each="userinfo:${userinfo}" th:text="${userinfo}"></td></tbody></table>
遍历List<Map>
<ul th:each="lm : ${listmap}"><li th:each="entry : ${lm}" th:text="${entry.key}" ></li><li th:each="entry : ${lm}" th:text="${entry.value}"></li></ul>
L
相关文章推荐
- freeMarker 遍历 list,map,list<map>
- List<Map<String,Object>>使用Java代码遍历以获取String,Object的值 .
- java中集合 list Map arraylist linkedlist hashmap ——学java,零基础不怕,不只要理论,更要实践+项目,<a href=http://www.bjweixin.com>太原维信科技提供 </a>
- Struts2标签遍历List<Map<String, String>>
- Map在jsp页面中的遍历(Map<String, List<T>>)
- HasMap中添加List<String>遍历输出结果不对
- Struts2标签遍历List<Map<String, String>>
- List<Map<String,Object>>使用Java代码遍历以获取String,Object的值
- List<Map>集合根据Map里某个key对List集合重新排序介绍
- Java基础List<Map<String, String>>
- 关于jsp利用EL和struts2标签来遍历ValueStack的东东 ------> List<Map<K,V>> 以及 Map<K,<List<xxx>>> 的结构遍历
- List<Map<String,Object>>使用Java代码遍历以获取String,Object的值
- freemarker中遍历list<map<String,String>>
- Struts2.3,<s:iterator>,<c:forEach>遍历map中的list集合
- 通过Struts标签和JSTL标签来遍历List<Map<String,String>>格式的数据
- List<Map<String,Object>>使用Java代码遍历以获取String,Object的值
- List<Map<String,Object>几种遍历的方法
- jquery遍历从后台返回的List<Map>
- struts1、struts2 遍历map<String,List<TItem>>
- Struts2标签遍历List<Map<String, String>>