el表达式和jstl整理

<c:if test="${empty var1}">
    var1 is empty or null.
</c:if>
<c:if test="${not empty var1}">
    var1 is NOT empty or null.
</c:if>


<c:if test="${fn:length(list)==0}">数组为空</c:if> 


<c:choose>
    <c:when test="${empty var1}">
        var1 is empty or null.
    </c:when>
    <c:otherwise>
        var1 is NOT empty or null.
    </c:otherwise>
</c:choose>


<c:forEach items="${vectors}" var="vector">
<c:out value="${vector}"/>
</c:forEach>

<c:import url="http://www.url.com/edit.js" var="newsfeed"/>


重定向
<c:redirect url="http://www.yourname.com/login.jsp"/>
重定向带参数
<c:redirect url="login.jsp">
<c:param name="id" value="888"/>
</c:redirect>


当要存取的属性名称中包含一些特殊字符,如.或?等并非字母或数字的符号,就一定要使用 []。
例如:${user.My-Name}应当改为${user["My-Name"] }


<%@ taglib prefix="fmt" http://java.sun.com/jsp/jstl/fmt">http://java.sun.com/jsp/jstl/fmt" %>
1)格式化日期<fmt:formatDate value=“” pattern=“yyyy-MM-dd HH:mm:ss”/>
             <fmt:formatDate value="${date }" pattern="yyyy-MM-dd"/>
             <fmt:formatDate value="${date }" pattern="yyyy年MM月dd日"/>                      
2) 格式化数字<fmt:formatNumber  value="${number}" pattern="###,###.##" />
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值