jsp页面中的c:foreach的varStatus的值:很坑,长姿势了

先上代码type的长度是2,attr的属性是4:

其中type的id=1的有三条属性

type=2有一条属性


<c:forEach items="${typeList}" var="type" varStatus="index">
			<tr>
				<th width="15%">分类信息</th>
				<th>${type.typename }
					<input type="hidden" name="type${index.index }" value="${type.id }"/> 
				</th>
			</tr>
			<c:if test="${fn:length(addAttrList)==0}">
				<c:forEach items="${attrList}" var="attr" varStatus="seq">
					<c:if test="${type.id == attr.type}">
						<tr>
							<td>${attr.name }
								<input type="hidden" name="attr${index.index }${seq.index }" value="${attr.id }"/> 
								<input type="hidden" name="name${index.index }${seq.index }" value="${attr.name }"/> 
							</td>
							<td>
								<input type="text" id="value${index.index }${seq.index }" name="value${index.index }${seq.index }" value="" class="required" title="请输入属性值"/>
							</td>
						</tr>
					</c:if>
				</c:forEach>
			</c:if>

很简单的循环套一个循环, 为什么是13而不是10????

jsp页面中的c:foreach的varStatus的值:很坑,长姿势了_第1张图片


那就是说seq在第二次循环开始的时候不是从0开始???



我去,这太逆天了!!跟平时用的for循环差这么多???坑




好吧,今天涨姿势了!!!!!!!!!!

你可能感兴趣的:(varStatus,cforEach)