项目中用到jsp中的c标签,因为之前没接触过,做个笔记方便以后再看。
判断list的length都为1则生成未被disabled的按钮
<c:choose>
<c:when test="${fn:length(gasPlateDtoList)==1 && fn:length(gasCompanyDtoList)==1}">
<input type="button" value="确认支付" id="payBtn">
</c:when>
<c:otherwise>
<input type="button" value="确认支付" id="payBtn" disabled>
</c:otherwise>
</c:choose>
如果list的length为1则显示input,大于1则显示select
<c:if test="${fn:length(gasCompanyDtoList)>1}">
<select class="companyList">
<option class="company" value>请选择公司名称</option>
<c:forEach items="${gasCompanyDtoList}" var="companyInfo">
<option class="company" value="${companyInfo.id}">${companyInfo.companyName}</option>
</c:forEach>
</select>
<img class="rightArrow" src="${ctx}/resources/wx/images/right.png">
</c:if>
判断list是否为空
<c:if test="${empty gasPlateDtoList}"></c:if>
使用之前fn和c标签之前要引入这些
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>