Java/JSTL/String

Материал из Java эксперт
Перейти к: навигация, поиск

Using the JSTL functions

   <source lang="java">

<%@ taglib uri="http://java.sun.ru/jsp/jstl/functions" prefix="fn" %> <%@ taglib uri="http://java.sun.ru/jsp/jstl/core" prefix="c" %> <html> <head><title>Using the JSTL functions</title></head> <body>

Using various JSTL 1.1 functions

<c:set var="tempStr" value="I love Java an www.jexp.ru"/> The length of the test String: ${fn:length(tempStr)}
Does the test String contain "test"? ${fn:contains(tempStr,"test")}
Putting the String into upper case using fn:toUpperCase(): ${fn:toUpperCase(tempStr)}
Splitting the String into a String array using fn:split(), and returning the array length: ${fn:length(fn:split(tempStr," "))}
</body> </html>


      </source>