在 jsp 页面中,我试图更改表格中一行的颜色,即如果满足条件,则应更改行的颜色

问题描述 投票:0回答:0

我是 jsp 和 spring 的新手,从控制器,我将一个(启用)布尔值传递给 jsp 页面,并在迭代时为每个页面组件分配值,如果启用为 false,我想更改行颜色。

你能告诉我什么是最好的方法吗

    <table id="DetailTable" class="table table-striped table-bordered" style="width:100%;">
                        <thead>
                            <tr>  
                                <th>S/no</th>
                                <th>Serial No</th>
                                                                <th>enabled</th>
                                <th>File Name</th>
    
                            </tr>
                        </thead>

<tbody>
<c:forEach items="${PropertiesLst}" var="Properties" varStatus="cnt">   
<c:if test="${not empty Properties.serialNum }">
<tr <c:if test="${!Properties.enable}"> class="red"</c:if>>
<td>${cnt.index+1}</td>
<td>${Properties.enabled}</td   
<td>${Properties.filename}</td  
</tr>
</c:if> 
</c:forEach>    
</tbody>
</table>        

如果布尔值为假,表格内的行应该是红色的。否则应该 bld

java spring-mvc jsp jsp-tags
© www.soinside.com 2019 - 2024. All rights reserved.