六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 34|回复: 0

JSTL的EL表达式fn函数

[复制链接]

升级  36%

26

主题

26

主题

26

主题

秀才

Rank: 2

积分
104
 楼主| 发表于 2013-2-4 20:00:07 | 显示全部楼层 |阅读模式
1.<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>  2.  3.fn:contains 判断字符串是否包含另外一个字符串 <c:if test="${fn:contains(name, searchString)}">    4.fn:containsIgnoreCase 判断字符串是否包含另外一个字符串(大小写无关) <c:if test="${fn:containsIgnoreCase(name, searchString)}">    5.fn:endsWith 判断字符串是否以另外字符串结束 <c:if test="${fn:endsWith(filename, ".txt")}">    6.fn:escapeXml 把一些字符转成XML表示,例如 <字符应该转为< ${fn:escapeXml(param:info)}    7.fn:indexOf 子字符串在母字符串中出现的位置 ${fn:indexOf(name, "-")}    8.fn:join 将数组中的数据联合成一个新字符串,并使用指定字符格开 ${fn:join(array, ";")}    9.fn:length 获取字符串的长度,或者数组的大小 ${fn:length(shoppingCart.products)}    10.fn:replace 替换字符串中指定的字符 ${fn:replace(text, "-", "•")}    11.fn:split 把字符串按照指定字符切分 ${fn:split(customerNames, ";")}    12.fn:startsWith 判断字符串是否以某个子串开始 <c:if test="${fn:startsWith(product.id, "100-")}">    13.fn:substring 获取子串 ${fn:substring(zip, 6, -1)}    14.fn:substringAfter 获取从某个字符所在位置开始的子串${fn:substringAfter(zip, "-")}    15.fn:substringBefore 获取从开始到某个字符所在位置的子串 ${fn:substringBefore(zip, "-")}    16.fn:toLowerCase 转为小写 ${fn.toLowerCase(product.name)}    17.fn:toUpperCase 转为大写字符 ${fn.UpperCase(product.name)}    18.fn:trim 去除字符串前后的空格 ${fn.trim(name)}   多次替换的时候可以这样使用
${fn:replace(fn:replace(monthList,'年',''),'月','')} 
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表