Before using the jstl function tag library, you need to introduce it into the page:
<%@ taglib prefix="fn" uri="http://java.sun. com/jsp/jstl/functions"%>
1. fn:contains(string, substring)
If the parameter string contains the parameter substring, return true.
2. fn:containsIgnoreCase(string, substring)
If the parameter string contains the parameter substring (ignore case), return true
3. fn:endsWith(string, suffix)
If the parameter string ends with the parameter suffix, return true.
4. fn:escapeXml(string)
Convert XML (and HTML) with special meaning into the corresponding XML character entity code and return it.
5. fn:indexOf(string, substring)
Returns the position where parameter substring first appears in parameter string.
6. fn:join(array, separator)
String a given array array together with the given separator to form a new string. return.
7. fn:length(item)
Returns the number of elements contained in the parameter item. The parameter Item type is array, collection or String. If it is a String type, the return value is the number of characters in the String.
1 <body> 2 <% 3 String a[] = {"aa","bb","cc","dd"}; 4 request.setAttribute("array",a); 5 request.setAttribute("store","guomei8899"); 6 %> 7 <c:if test="${fn:contains('guomeiddd','guoMei')}">ok</c:if><br> 8 <c:if test="${fn:containsIgnoreCase(store,'guoMei')}">ok ok</c:if><br> 9 <c:if test="${fn:endsWith(store,'99')}">end</c:if><br>10 <c:out value="${fn:escapeXml('<>')}"/><br>11 <c:out value="${fn:indexOf(store,'om')}"/><br>12 <c:out value="${fn:join(array,'|')}"/><br>13 <c:out value="${fn:length(array)}"/><br>14 </body>
8. fn:replace(string, before, after)
Returns a String object. Replace all occurrences of the parameter before string in the parameter string with the parameter after string, and return the replacement result.
9. fn:startsWith(string, prefix)
If the parameter string starts with the parameter prefix, return true.
10. fn:substring(string, begin, end)
Returns the string part of the parameter string, starting from the parameter begin to the parameter end position.
11. fn:substringAfter(string, substring)
Returns the part of the string after the parameter substring in the parameter string.
12. fn:substringBefore(string, substring)
Returns the part of the string in front of the parameter substring in the parameter string.
13. fn:toLowerCase(string)
Changes all the characters in the parameter string to lowercase and returns them.
14. fn:toUpperCase(string)
Changes all the characters in the parameter string to uppercase and returns them.
15. fn:trim(string)
Remove the spaces at the beginning and end of the parameter string and return it.
1 <body> 2 <% 3 String a[] = {"aa","bb","cc","dd"}; 4 request.setAttribute("array",a); 5 request.setAttribute("store","guomei8899"); 6 request.setAttribute("user","u1,u2,u3,u4,u5"); 7 request.setAttribute("test","aBcDeF "); 8 %> 9 <c:out value="${fn:replace(store,'8','9')}"/><br>10 <c:out value="${fn:split(user,',')}"/><br>11 <c:out value="${fn:startsWith(store,'g')}"/><br>12 <c:out value="${fn:substring(store,2,5)}"/><br>13 <c:out value="${fn:substringAfter(store,'mei')}"/><br>14 <c:out value="${fn:substringBefore(store,'mei')}"/><br>15 <c:out value="${fn:toLowerCase(test)}"/><br>16 <c:out value="${fn:toUpperCase(test)}"/><br>17 <c:out value="${test}hoho"/><br>18 <c:out value="${fn:trim(test)}hoho"/><br>19 </body>