第一个就是流程控制标签里面的if。用的是许多。
详细写法:
<c:if test="条件">运行语句</c:if>比方条件1成立,就显示一个button,条件2成立就显示一个超链接:
<c:if test="条件1"> <input id="submit_btn" class="btn btn-primary" type="submit" value="提交"/></c:if> <c:if test="条件2"><a href="http://www.baidu.com" target="_blank">百度一下</a></c:if>假设要进行逻辑推断的话,使用and和or,这个和java里面的&&和||不同,開始我也以为是java这种。后来才知道不是。
使用<c:choose></c:choose>里面在套<c:when test=" "></c:when>进行多个语句的推断就可以
<c:choose>
<c:when test="${score>=90}">
你的成绩为优秀。
</c:when>
<c:when test="${score>=70 and score<90}">
您的成绩为良好!
</c:when>
<c:when test="${score>60 and score<70}">
您的成绩为及格
</c:when>
<c:otherwise>
对不起。您没有通过考试!
</c:otherwise>
</c:choose>
流程控制标签讲完了。在说循环标签,这里讲一个forEach<c:forEach var="product" items="${allProducts}">
<label class="checkbox inline">
<input type="checkbox" name="productId" value="${product.id}">${product.name}
</label>
</c:forEach><c:forEach>标签还能够加varStatus="idx",然后在里面我们能够进行推断比方${idx.index>0}或者${idx.index++}要导入标签:<%@
taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
${fn:length(product.selllingPoints)} 原文:http://www.cnblogs.com/ljbguanli/p/7389145.html