Map在jsp页面中的遍历(Map<String, List<T>>)

JAVA代码

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> οnclick="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>


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值