浅尝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
<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
相关文章推荐
- EL表达式不能用于js文件中,一般用于jsp文件
- Javascript 内存管理
- js加载等待,js进度等待
- 【译】Javascript中的数据类型
- JavaScript 开发的45个经典技巧
- js性能优化
- “好程序员训练营”——JavaScript笔记
- js 将json字符串转换为json对象的方法解析
- Javascript 闭包
- Json转换利器Gson之实例一-简单对象转化和带泛型的List转化
- JSP(3) ----JDBC编程2
- js 调用 DOM js练习入门
- Js-字符串截取substring,分割split,指标indexOf,拼接John
- JavaScript中的Math.SQRT1_2属性使用简介
- js-回车事件控制
- 简介JavaScript中Math.LOG10E属性的使用
- js比较年月日或者日期年月日时分秒大小
- json数据解析
- JavaScript新手学习笔记(一)
- JSON、使用JSON进行数据交换的基础和原理