JSTL标签 使用的备忘
参考网址:http://arron-huang.iteye.com/blog/1109518
?
JSP文件头申明
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
?
函数名函数说明使用举例
contains判断字符串是否包含另外一个字符串<c:if test="${fn:contains(name, searchString)}">
containsIgnoreCase判断字符串是否包含另外一个字符串(大小写无关)<c:if test="${fn:containsIgnoreCase(name, searchString)}">
endsWith判断字符串是否以另外字符串结束<c:if test="${fn:endsWith(filename, ".txt")}">
escapeXml把一些字符转成XML表示,例如<字符应该转为<${fn:escapeXml(param:info)}
indexOf子字符串在母字符串中出现的位置${fn:indexOf(name, "-")}
join将数组中的数据联合成一个新字符串,并使用指定字符格开${fn:join(array, ";")}
length获取字符串的长度,或者数组的大小${fn:length(shoppingCart.products)}
replace替换字符串中指定的字符${fn:replace(text, "-", "•")}
split把字符串按照指定字符切分${fn:split(customerNames, ";")}
startsWith判断字符串是否以某个子串开始<c:if test="${fn:startsWith(product.id, "100-")}">
substring获取子串${fn:substring(zip, 6, -1)}
substringAfter获取从某个字符所在位置开始的子串 ${fn:substringAfter(zip, "-")}
substringBefore获取从开始到某个字符所在位置的子串${fn:substringBefore(zip, "-")}
toLowerCase转为小写${fn.toLowerCase(product.name)}
toUpperCase转为大写字符${fn.UpperCase(product.name)}
trim去除字符串前后的空格${fn.trim(name)}
?
一下是利用表达式函数解决input输入框中双引号"无法显示的问题
value="${fn:replace(要替换的属性名称,"\"",""")} "
?
?
?