示例
以下示例说明了fn:trim()函数的功能-
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
<html>
<head>
<title>Using JSTL Functions</title>
</head>
<body>
<c:set var = "string1" value = "This is first String"/>
<p>String (1) Length : ${fn:length(string1)}</p>
<c:set var = "string2" value = "${fn:trim(string1)}" />
<p>String (2) Length : ${fn:length(string2)}</p>
<p>Final string : ${string2}</p>
</body>
</html>
上面的代码将产生以下结果-
String (1) Length : 29
String (2) Length : 20
Final string : This is first String