<c:if test="></c:if>判断字符串的长度并部分显示
2014-05-30 11:31
435 查看
在开发工程中,往往会遇到表格中只能放少量信息,而从数据库中获取到的字符串的长度又比较大,此时用c:if 便可解决,
<%@ taglib uri="htp://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="htp://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="htp://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:if test="${fn:length(item.connext) > 30}">${fn:substring(item.connext, 0, 30)}...... </c:if>
类别 运算符
算术运算符 + 、 - 、 * 、 / (或 div )和 % (或 mod )
关系运算符 == (或 eq )、 != (或 ne )、 < (或 lt )、 > (或 gt )、 <= (或 le )和 >= (或 ge )
逻辑运算符 && (或 and )、 || (或 or )和 ! (或 not )
验证运算符 empty
小例子:
<tr <c:if test="${status.count%2==0}">bgcolor="#CCCCFE"</c:if> align="left">
xxx
</tr>
<%@ taglib uri="htp://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="htp://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="htp://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:if test="${fn:length(item.connext) > 30}">${fn:substring(item.connext, 0, 30)}...... </c:if>
类别 运算符
算术运算符 + 、 - 、 * 、 / (或 div )和 % (或 mod )
关系运算符 == (或 eq )、 != (或 ne )、 < (或 lt )、 > (或 gt )、 <= (或 le )和 >= (或 ge )
逻辑运算符 && (或 and )、 || (或 or )和 ! (或 not )
验证运算符 empty
小例子:
<tr <c:if test="${status.count%2==0}">bgcolor="#CCCCFE"</c:if> align="left">
xxx
</tr>
相关文章推荐
- struts2标签 截取字符串 <s:if test=""></if>判断
- mybatis 里面使用<if test=""> 判断,当后台传的值是数字字符串时,怎么处理
- 只显示 前100个字 java 实现截取字符串!使用! <c:if test="${fn:length(onebeans.info)>100 }">${ fn:substri
- <c:if test=" ${cppc.hpid==hpcc.id}">条件判断
- 【<if test="takeWay == '0'">】mybatis的if判断有坑
- MyBatis 判断条件为等于的问题(<if test="type == '1'.toString()"> xxx </if>
- mybatics中【<if test="takeWay == '0'">】mybatis的if判断
- jsp页面中的<c:if test="">中的<%= %>判断是否相等
- <s:if test="">标签以动态数据为判断条件
- 【mybatis】IF判断的坑 (实现<if test=" status == 'zhangsan'">)
- <c:if test=""></c:if>如何判断空(使用例子)
- <c:if test=""></c:if>如何判断空(使用例子)
- 【mybatis】IF判断的坑 (实现<if test=" status == 'zhangsan'">)
- <c:if test="">多条件判断
- struts2 <s:if test="">判断字符串
- <c: if test="">判断无效
- Struts标签<s:if>判断字符串是否包含一个固定的值
- iOS 判断字符串"<null>"类型
- <c:if test="value ne, eq, lt, gt,...."> 用法
- mybatis的参数 <if test="_parameter != null" > </if>