EL表达式---函数
来源:互联网 发布:caffe 数据层 编辑:程序博客网 时间:2024/05/20 22:40
1.引入函数标签库
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
2.语法
${fn:length(list)} fn是引入标签库是起的名字 prefix="fn" 此方法是获取字符串长度
函数名 函数说明 使用举例
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)}
特别强调:
1、注意当表达式根据名称引用这些对象之一时,返回的是相应的对象而不是相应的属性。例如:即使现有的 pageContext 属性包含某些其他值,${pageContext} 也返回 PageContext 对象。
2、 注意 <%@ page isELIgnored="true" %> 表示是否禁用EL语言,TRUE表示禁止.FALSE表示不禁止.JSP2.0中默认的启用EL语言。
- EL表达式常用函数
- EL表达式调用函数
- EL表达式-自定义函数
- EL 表达式中的函数
- EL表达式调用函数
- EL表达式---函数
- 运用El表达式函数
- EL表达式-自定义函数
- EL表达式函数
- el表达式函数用法
- EL表达式-自定义函数
- EL表达式调用函数
- el表达式内置函数
- EL表达式中的函数
- EL表达式-自定义函数
- 自定义el表达式函数
- EL表达式-自定义函数
- EL 表达式调用函数
- php74 骑士 火车头采集简历 接口及采集规则
- Spring(事务通配符)
- Linux Slub分配器(七)--销毁缓存
- EL表达式不起作用的解决方法
- ios 滑动swipe识别
- EL表达式---函数
- 如何用DOS获得目标主机的IP(媒介类似qq聊天等通讯工具)
- The reference to entity "characterEncoding" must end with the ';' delimiter
- iphone内存检测
- libxml2在linux下的使用
- The prefix "mvc" for element "mvc:annotation-driven" is not bound 的解决方法
- 基于OGNL的类型转换
- Codeforces Round #124 (Div. 2)
- Could not parse xs:dateTime: Format.parseObject(String) failed