struts_JSP之JSTL_functions
2014-08-13 16:38
155 查看
一、
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
二、
在WEB-INF目录下创建functions.ltd
然后将上述代码拷进去
<%@ taglib prefix="fn" uri="/WEB-INF/functions.tld" %>
或则
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
区别在于说这样的话即使不联网也可以使用
<!-- 函数说明 -->
函数名 函数说明 使用举例
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)}
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
二、
在WEB-INF目录下创建functions.ltd
然后将上述代码拷进去
<%@ taglib prefix="fn" uri="/WEB-INF/functions.tld" %>
或则
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
区别在于说这样的话即使不联网也可以使用
<!-- 函数说明 -->
函数名 函数说明 使用举例
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)}
相关文章推荐
- 恼人的The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved...错误,无奈用Struts的bean:write替代了JSTL的C:out
- JSP之JSTL_functions
- eclipse提示Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/functions"
- 在Struts的jsp中使用<s: set> 和 Jstl的<c: set>
- 变量存取范围及JSP、JSTL和Struts技术中变量的存取方法
- JSP, Struts, JSTL——Java开发框架下的模板语言
- JSP之JSTL_functions
- jsp技术:day5#1-JSTL--Functions标签
- jsp 函数标签库(http://java.sun.com/jsp/jstl/functions)
- JSP之JSTL_functions
- JSP之JSTL functions
- 引入不了<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>标签库的问题
- JSP标签库之JSTL-functions
- JSP EL标签不能和struts tag 一起使用,只能和JSTL一起使用了。
- 【Java.Web】JSP —— 标签库taglib —— 第三方标签库 —— JSTL Functions
- jsp默认语法、EL、JSTL表达式,JSTL和struts Tag标签的使用总结
- 变量存取范围及JSP、JSTL和Struts技术中变量的存取方法
- 变量存取范围及JSP、JSTL和Struts技术中变量的存取方法
- http://java.sun.com/jsp/jstl/functions
- Maven将项目部署到Tomcat-报错:java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config