Revisit the JSP learning note--el function library

Source: Internet
Author: User

El function library (provided by JSTL)
* Import Tag library: <%@ tablib prefix= "FN" uri= "Http://java.sun.com/jsp/jstl/functions"%>
String toUpperCase (String input): Converts a parameter to uppercase
String toLowerCase (String input): Converts arguments to lowercase
int indexOf (string input, String substring): From a large string, output a small string of positions!
Boolean contains (string input, String substring): To see if a string is included in a large string
Boolean containsignorecase (string input, string substring): Ignores case, contains
Boolean StartsWith (string input, String substring): is prefixed with a small string
Boolean EndsWith (string input, string substring): Whether to use small strings as suffixes
String substring (string input, int beginindex, int endIndex): Intercept substring
String Substringafter (string input, string substring): Gets the string that follows the position of the small string in a large string
Substringbefore (string input, string substring): Gets the string in front of the small string in the large string
String EscapeXML (String input): Escapes input "<", ">", "&", "" "," ""
String trim (String input): Remove spaces before and after
String replace (string input, String substringbefore, String substringafter): Replace
String[] Split (string input, string delimiters): Splits a string to get an array of strings
int length (Object obj): You can get the lengths of strings, arrays, various collections!
String join (String array[], string separator): union string Array!

Here is an example:

1 <%@taglib prefix="fn"URI="http://java.sun.com/jsp/jstl/functions" %>2 ... ..3 string[] STRs = {"A", "B", "C"};4 List List = new ArrayList ();5 List.add ("a");6 Pagecontext.setattribute ("arr", STRs);7 pagecontext.setattribute ("list", list);8 %>9${fn:length (ARR)}<BR/><!--3 -Ten${fn:length (List)}<BR/><!--1 - One${fn:tolowercase ("Hello")}<BR/> <!--Hello - A${fn:touppercase ("Hello")}<BR/> <!--HELLO - -${fn:contains ("abc", "A")}<BR/><!--true - -${fn:containsignorecase ("abc", "Ab")}<BR/><!--true - the${fn:contains (arr, "a")}<BR/><!--true - -${fn:containsignorecase (list, "A")}<BR/><!--true - -${fn:endswith ("Hello.java", ". Java")}<BR/><!--true - -${fn:startswith ("Hello.java", "Hell")}<BR/><!--true - +${fn:indexof ("Hello-world", "-")}<BR/><!--5 - -${fn:join (arr, ";")}<BR/><!--a;b;c - +${fn:replace ("Hello-world", "-", "+")}<BR/><!--Hello+world - A${fn:join (Fn:split ("A;B;C;", ";"), "-")}<BR/><!--a-b-c - at  -${fn:substring ("0123456789", 6, 9)}<BR/><!--678 - -${fn:substring ("0123456789", 5,-1)}<BR/><!--56789 - -${fn:substringafter ("Hello-world", "-")}<BR/><!-- World - -${fn:substringbefore ("Hello-world", "-")}<BR/><!--Hello - -${fn:trim ("a b C")}<BR/><!--a b c - in${fn:escapexml ("<HTML></HTML>")}<BR/> <!-- -

Revisit the JSP learning note--el function library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.