Map在jsp页面中的遍历(Map<String, List<T>>)
2013-08-26 17:38
453 查看
JAVA代码
js代码
if(StringUtil.isNotNull(businessId)){ List<AppProjPropLink> linkList = projTypeService.getCusPropByProjTypeId(businessId, metaCode); Map<String, List<AppProjPropLink>> map = new HashMap<String, List<AppProjPropLink>>(); for (AppProjPropLink appProjPropLink : linkList) { if(!StringUtil.isNotNull(appProjPropLink.getMetaProp().getDictSelfGroup())){ if(!StringUtil.isNotNull(map.get("未分组"))){ List<AppProjPropLink> tempList = new ArrayList<AppProjPropLink>(); tempList.add(appProjPropLink); map.put("未分组", tempList); }else{ List<AppProjPropLink> tempList = map.get("未分组"); tempList.add(appProjPropLink); map.put("未分组", tempList); } }else{ if(!StringUtil.isNotNull(map.get(appProjPropLink.getMetaProp().getDictSelfGroup().getName()))){ List<AppProjPropLink> tempList = new ArrayList<AppProjPropLink>(); tempList.add(appProjPropLink); map.put(appProjPropLink.getMetaProp().getDictSelfGroup().getName(), tempList); }else{ List<AppProjPropLink> tempList = map.get(appProjPropLink.getMetaProp().getDictSelfGroup().getName()); tempList.add(appProjPropLink); map.put(appProjPropLink.getMetaProp().getDictSelfGroup().getName(), tempList); } } } model.addAttribute("map", map); }
js代码
<form id="propertyListForm" method="post"> <input type="hidden" name="projTypeId" id="projTypeId" value="${businessId}"/> <table align="center" width="100%"> <tr> <td width="40%">属性名称</td> <td width="30%">是否选择</td> <td width="30%">是否必填</td> </tr> </table> <c:forEach items="${map}" var="entry"> <fieldset> <legend>${entry.key}:</legend> <table align="center" width="100%"> <c:forEach items="${entry.value }" var="link"> <tr> <td width="40%"><label>${link.metaProp.name}</label></td> <td width="30%"><input type="checkbox" name="isChecked" value="${link.metaProp.id}" <c:if test="${link.id ne null}">checked="checked"</c:if> onclick="setDisabled('${link.metaProp.id}')"/></td> <td width="30%"><input id="${link.metaProp.id}" type="checkbox" name="isRequired" <c:if test="${link.id eq null}">disabled="true"</c:if> <c:if test="${link.isRequired eq '1'}">checked="checked"</c:if>/></td> </tr> </c:forEach> </table> </fieldset> </c:forEach> </form>
相关文章推荐
- jsp页面遍历List<Map<String,Object>>
- jsp遍历List<Map<String,Object>>,输出<Map<String,Objectr>>
- jsp标签中遍历List<Map<String, List<Object>>>类型的数据
- 在 JSP页面中遍历 Map<Integer, List<User>> 类型, 如何做?
- List<Map<String,Object>> list 在java代码和jsp中的遍历
- javaweb --- jsp页面遍历list<map>类型的数据
- List<Map<String,String>>的遍历
- 将List<Map<String, Object>>遍历后存入List<Object<String,String,List<Map<String, String>>>中>
- JAVA遍历List<Map<String,Object>> 如何根据List中Map的Value的值进行遍历
- List<map<String,Object>>java遍历
- freemarker中遍历list<map<String,String>>
- freemarker中遍历list<map<String,String>>
- 遍历List<Map<String,Object>>
- List<Map<String,Object>几种遍历的方法
- 遍历List<Map<String, Object>>
- List<Map<String,Object>>使用Java代码遍历以获取String,Object的值
- 遍历List<String[]>并 转换为String[][],List<List<String>>,Map<String,String[]> .
- List<Map<String,Object>>使用Java代码遍历以获取String,Object的值 .
- Dom4j解析XML文本,遍历指定节点下的节点内容和属性,并存入List<Map<String,Object>
- 遍历List<Map<String, Object>>