EL表达式各种函数使用大全
2018-09-11 10:06
435 查看
引入<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
另外:el判断关键字:
eq相等 ne、neq不相等,
gt大于, lt小于
gt大于, lt小于
gte、ge大于等于
lte、le 小于等于
not非 mod求模
is [not] div by是否能被某数整除
is [not] even是否为偶数
is [not] even by $b即($a / $b) % 2 == 0
is [not] odd是否为奇
is not odd by $b即($a / $b) % 2 != 0
示例:
equal/ not equal/ greater than/ less than/ less than or equal/ great than or equal/后面的就不用说了
函数名 | 函数说明 | 使用举例 |
fn:contains | 判断字符串是否包含另外一个字符串 | <c:if test="${fn:contains(name, searchString)}"> |
fn:containsIgnoreCase | 判断字符串是否包含另外一个字符串(大小写无关) | <c:if test="${fn:containsIgnoreCase(name, searchString)}"> |
fn:endsWith | 判断字符串是否以另外字符串结束 | <c:if test="${fn:endsWith(filename, ".txt")}"> |
fn:escapeXml | 把一些字符转成XML表示,例如<字符应该转为< | ${fn:escapeXml(param:info)} |
fn:indexOf | 子字符串在母字符串中出现的位置 | ${fn:indexOf(name, "-")} |
fn:join | 将数组中的数据联合成一个新字符串,并使用指定字符格开 | ${fn:join(array, ";")} |
fn:length | 获取字符串的长度,或者数组的大小 | ${fn:length(shoppingCart.products)} |
fn:replace | 替换字符串中指定的字符 | ${fn:replace(text, "-", "")} |
fn:split | 把字符串按照指定字符切分 | ${fn:split(customerNames, ";")} |
fn:startsWith | 判断字符串是否以某个子串开始 | <c:if test="${fn:startsWith(product.id, "100-")}"> |
fn:substring | 获取子串 | ${fn:substring(zip, 6, -1)} |
fn:substringAfter | 获取从某个字符所在位置开始的子串 | ${fn:substringAfter(zip, "-")} |
fn:substringBefore | 获取从开始到某个字符所在位置的子串 | ${fn:substringBefore(zip, "-")} |
fn:toLowerCase | 转为小写 | ${fn.toLowerCase(product.name)} |
fn:toUpperCase | 转为大写字符 | ${fn.UpperCase(product.name)} |
fn:trim | 去除字符串前后的空格 | ${fn.trim(name)} |
eq相等 ne、neq不相等,
gt大于, lt小于
gt大于, lt小于
gte、ge大于等于
lte、le 小于等于
not非 mod求模
is [not] div by是否能被某数整除
is [not] even是否为偶数
is [not] even by $b即($a / $b) % 2 == 0
is [not] odd是否为奇
is not odd by $b即($a / $b) % 2 != 0
示例:
equal/ not equal/ greater than/ less than/ less than or equal/ great than or equal/后面的就不用说了
相关文章推荐
- JSTL标签库大全之-------国际化( I18N )标签库,各种标签及其函数的使用。
- VC------Windows关机函数,休眠函数使用大全(适用Windows所有操作平台)
- oracle常用函数使用大全
- Win32 API 函数大全使用详解十 鼠标输入函数
- 各种缓存使用大全
- typedef使用大全3(指向函数的指针)
- (转)C#日期函数使用大全
- typedef使用大全(指向函数的指针)
- oracle常用函数使用大全
- delphi6 函数大全使用详解
- C 函数大全--去除了不经常使用的。
- php使用频率较高的函数大全
- C++中各种数据成员及成员函数的定义及使用
- SQL Server中时间函数使用大全
- typedef使用大全3(指向函数的指针)//typedef的使用可以隐藏复杂的函数指针语法
- Sql常见问题总结二(Sql语句怎么样查询IP,游标去重复,各种函数使用,各种取时间格式,字符串精确排序,超时锁问题)
- oracle常用函数使用大全
- typedef使用大全(指向函数的指针)
- asp.net各种函数大全(总括)
- Win32 API 函数大全使用详解十 鼠标输入函数