您的位置:首页 > Web前端 > JavaScript

浅尝JSTL标准标签库

2015-06-14 14:28 555 查看
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="#" onclick="cancelS'${report.id}')" style="color:#115a6f">

取消

</a>

</c:when>

<c:otherwise>

<a id="${report.id}" href="#" onclick="shoucang('${report.id}')" style="color:#115a6f">

收藏

</a>

</c:otherwise>

</c:choose>

</span>

<a href="#" onclick="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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: