tab页两个foreach同步刷新问题

可以默认显示第一个

<div class="col-md-12">
<section class="box10">
<!-- Custom Tabs -->
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<c:forEach items="${variableblock }" var="block" varStatus="s">
<li <c:if test="${s.index==0 }">class="active"</c:if>><a href="#tab_${block.id }" data-toggle="tab">${block.blockname }</a></li>
</c:forEach>            //通过两个active控制显示第一个tab
</ul>
<div class="tab-content">

<c:forEach items="${variableblock }" var="block" varStatus="s">      //两个相同的foreach   通过id对应
<div <c:if test="${s.index==0 }">class="tab-pane active"</c:if> <c:if test="${s.index!=0 }">class="tab-pane"</c:if> id="tab_${block.id }">

<div class="box-body table-responsive no-padding" style="overflow-x:hidden">
<table class="table table-hover table-text">
<thead>
<tr class="tabth">
<th style="6%">序号</th>
<th style="9%">变量名</th>
<th style="9%">变量标签</th>
<th style="8%">控件类型</th>
<th style="7%">默认值</th>
<th style="8%">受控字典</th>
<th style="6%">单位</th>
<th style="8%">变量角色</th>
<th style="8%">关联规则</th>
<th style="7%">创建人</th>
<th style="10%">创建时间</th>
<th style="7%">备注</th>
<th style="padding-left: 20px;7%" >操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${block.variablelist}" var="list" varStatus="s">
<tr>
<td>${ s.index + 1}</td>
<td>${list.variablename}</td>
<td>${list.variabletag}</td>
<td><c:if test="${list.plugintype==1}">test</c:if>
<c:if test="${list.plugintype==2}">number</c:if>
<c:if test="${list.plugintype==3}">date</c:if>
<c:if test="${list.plugintype==4}">radio(单选)</c:if>
<c:if test="${list.plugintype==5}">checkbox(多选)</c:if>
<c:if test="${list.plugintype==6}">download(下拉框)</c:if>
</td>
<td>${list.defaultvalue}</td>
<td>${list.controlledtermid}</td>
<td>${list.unitid}</td>
<td>
<c:if test="${list.roletype==1}">标识变量</c:if>
<c:if test="${list.roletype==2}">主题变量</c:if>
<c:if test="${list.roletype==3}">时间变量</c:if>
<c:if test="${list.roletype==4}">修饰语变量</c:if>
<c:if test="${list.roletype==5}">规则变量</c:if>

</td>
<td>${list.ruleid}</td>
<td>admin</td>
<td><fmt:formatDate value='${list.createtime }' type='date' pattern='yyyy-MM-dd HH:mm:ss'/></td>
<td>${list.memo}</td>
<td>
<a class="fa fa-trash fa-lg text-danger" href="javascript:deletevariable(${list.id});"></a>
<a class="fa fa-pencil fa-lg" style="margin-left: 30px;" href="javascript:updatevariable(${list.id});"></a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.tab-pane -->
</c:forEach>

</div><!-- /.tab-content -->
</div><!-- nav-tabs-custom -->
</section><!-- /.box-body -->
</div><!-- /.col -->

当能力支撑不了野心时,就该静下心来学习!
原文地址:https://www.cnblogs.com/1234cjq/p/6482890.html