c:if标签判断不为空和其他的值判断

今天用<c:if test=""></c:if>标签时
<c:if test="${sl.chc_status==1 }">未指派</c:if> 一直出不来
后来才发现 不同的类型有不同的判断

一,el表达式用法:

1.项目中添加 jstl.jar 和 standard.jar 两个jar包。然后在页面最上面添加一行:
<%@taglib uri=“http://java.sun.com/jsp/jstl/core” prefix=“c”%>
在这里插入图片描述

2.然后就可以在你需要使用的位置输入el表达式
<c:if test=“判断条件”></c:if>
在这里插入图片描述

二,各种值不同的判断法
1,int 类型 判断

直接==就可以
<c:if test="${sl.chc_status == 1}"> 未指派 <c:if>

2,char 类型
char类型 需要对应的ASCII码
0对应的是48 ,1对应的是49 ,2对应的是50
附上完整的ASCII码表链接 http://tool.oschina.net/commons?type=4
例:
<c:if test=" s l . c h c s t a t u s = = 49 &quot; &gt; &lt; t d &gt; 未 指 派 &lt; / t d &gt; &lt; c : i f &gt; &lt; c : i f t e s t = &quot; {sl.chc_status == 49}&quot;&gt; &lt;td&gt;未指派&lt;/td&gt; &lt;c:if&gt; &lt;c:if test=&quot; sl.chcstatus==49"><td></td><c:if><c:iftest="{sl.chc_status == 50}"> 已指派 <c:if>

3,判断是否为空
例:
<c:if test=" e m p t y s a l e l i s t &quot; &gt; a l e l i s t 为 空 &lt; / c : i f &gt; &lt; c : i f t e s t = &quot; {empty sale_list}&quot;&gt; ale_list为空 &lt;/c:if&gt; &lt;c:if test=&quot; emptysalelist">alelist</c:if><c:iftest="{not empty sale_list}"> ale_list不为空 </c:if>
还有一些其他的用法我暂时没用就不写了,大家可以看看
这个链接:http://blog.csdn.net/kunkun378263/article/details/40819205
<c:if test=“value ne, eq, lt, gt,…”> 用法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值