JSTL常用标签:替代在页面写java代码
<c:choose>,<c:when>,<c:otherwise>标签和if-esle判断语句类似
如:
<c:choose>
<c:when test="${category.parent.parent.parent.id eq '1' }"><c:set var="categoryList1" value="${fnc:getCategoryList(site.id, category.parent.id, -1, null)}"></c:set>
</c:when>
<c:otherwise>
<c:set var="categoryList1" value="${fnc:getCategoryList(site.id, category.parent.parent.id, -1, null)}"></c:set>
</c:otherwise>
</c:choose>
<c:if >标签和if判断语句类似
<c:forEach>标签和for增强型语句类似
<fmt:formatDate>格式化时间格式
如:
<c:if test="${category.module eq 'report'}"><ul class="tab-content-ul">
<c:if test="${page.count>0}">
<c:forEach items="${page.list}" var="report">
<li >
<span class="pull-right" >
<fmt:formatDate value="${report.updateDate}" pattern="yyyy.MM.dd" />
<c:choose>
<c:when test="${fnc:store(report.id)}">
<a id="${report.id}" href="#" οnclick="cancelS'${report.id}')" style="color:#115a6f">
取消
</a>
</c:when>
<c:otherwise>
<a id="${report.id}" href="#" οnclick="shoucang('${report.id}')" style="color:#115a6f">
收藏
</a>
</c:otherwise>
</c:choose>
</span>
<a href="#" οnclick="show('${report.resId}','${report.reportSuffix}')" title="${fns:abbr(report.reportName,100)}" style="color:#115a6f">
${fns:abbr(report.reportName,100)}
</a>
</li>
</c:forEach>
</c:if>
</ul>
</c:if>
常用JSTL标准标签如上所示,全面的JSTL标准标签库请查询下面的网站
http://elf8848.iteye.com/blog/245559