开发者学堂课程【JPS 快速入门:EL函数库】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/33/detail/729
EL函数库
导入标签库:
<%@ tablib prefix="fn"uri=http://java.sun.com/jsp/jst1/functions%>
string toUppercase (String input):把参数转换成大写
String toLowercase (String input):把参数转换成小写
int indexOf(String input,String substring):从大串,输出小串的位置
boolean contains(String input,String substring):查看大串中是否包含小串
boolean containsIgnoreCase(String input,String substring):忽略大小写的,是否包含
boolean startsWith(String input,string substring):是否以小串为前缀
boolean endsWith(String input,String substring):+是否以小串为后缀
String substring (String input,int beginIndex,int endIndex):截取子串
String substringAfter(String input,String substring):获取大串中,小串所在位置后面的字符串substringBefore(String input,String substring):获取大串中,小串所在位置前面的字符串
string escapeXml(String input):把input中"<"、">"、"&"、"'"、""",进行转义
string trim (String input) :去除前后空格
String replace(String input,String substringBefore,String s
ubstringAfter):替换
String[] split(String input,String delimiters):分割字符串,得到字符串数组
int length(Object obj):可以获取字符串、数组、各种集合的长度
String join(String array[],String separator):联合字符串数组
<%@taglib, prefix="fn" uri="http://java.sun.com/jsp/jst1l/functions”%>
string [ ] strs= { "a","b","c"};
List list= new ArrayList();
List.add ( "a") ;
pageContext.setAttribute ("arr";strs);
pagaContext.setAttxibute ("list",list) ;
%>
$ {fn:length (arr)}
$ {fn:length (list) }
$ {fn;.toLowexCase("Hello") }
$ {fn:toUppercaae ( "Hello") }
$ {fn:.contains("abc","a") }
$ {fn:.containsIgnoreCase ("abc","Ab" ) }
$ {fn:contains(arr, "a") }
${fn:containsIganoreCase(list,"A")}
${fn:endsWith("Hello.java",".java")}
${fn:startsWith("Hello.java"."Hell")}
$ {fn:indexOf ( "Hello-world","-") }
$ { fn:.indexof("Hello-World" ,"-") }
$ { fn:join(arr,"; ")}
$ { fn:replace ("Hello-World","-","+")}
$ { fn:join(fn:split("a;b;c;","; "),"-")}
$ { fn:substring("0123456789",6,9)}
$ { fn:substring("0123456789",5,-1)}
${fn:substringAftex ( "Hello-World","-")}
$ { fn:substringBefore( "Hello-world","-")}
$ { fn.trim ("a b c") }
$ { fn:escapeXml ( "") }