Jstl Standard Functions
The declaration of a standard function must be introduced in the JSP before using these functions
<%@ taglib prefix= "FN" uri= "Http://java.sun.com/jsp/jstl/functions"%>
The following is a list of the methods that are in JSTL and their descriptions
Name of function |
Function description |
Examples of Use |
Contains |
Determine if a string contains another string |
<c:if test= "${fn:contains (name, SearchString)}" > |
Containsignorecase |
Determines whether a string contains another string ( case -insensitive ) |
<c:if test= "${fn:containsignorecase (name, SearchString)}" > |
EndsWith |
Determines whether a string ends with a different string |
<c:if test= "${fn:endswith (filename,". txt ")}" > |
EscapeXML |
Turn some characters into XML representations, such as < characters should be converted to < |
${fn:escapexml (Param:info)} |
IndexOf |
The position where the substring appears in the parent string |
${fn:indexof (Name, "-")} |
Join |
Unites the data in the array into a new string and uses the specified character format to open the |
${fn:join (Array, ";")} |
Length |
Gets the length of the string, or the size of the array |
${fn:length (Shoppingcart.products)} |
Replace |
Replace the character specified in the string |
${fn:replace (Text, "-", "?")} |
Split |
Segmentation the string according to the specified word |
${fn:split (Customernames, ";")} |
StartsWith |
Determines whether a string starts with a substring |
<c:if test= "${fn:startswith (product.id," 100-")}" > |
Substring |
Get child string |
${fn:substring (Zip, 6,-1)} |
Substringafter |
Gets the substring starting at the location of a character |
${fn:substringafter (Zip, "-")} |
Substringbefore |
Gets the substring from the beginning to the location of a character |
${fn:substringbefore (Zip, "-")} |
toLowerCase |
Convert to lowercase |
${fn.tolowercase (Product.name)} |
toUpperCase |
Convert to uppercase characters |
${fn. Uppercase (Product.name)} |
Trim |
Remove spaces before and after a string |
${fn.trim (name)} |
Copyright NOTICE: Welcome reprint, Hope in your reprint at the same time, add the original address, thank you with
Summary of JSTL Standard functions