fn_length.jsp

来自「jsp入门级代码」· JSP 代码 · 共 41 行

JSP
41
字号
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page contentType="text/html;charset=GBK"%>
<%@ page isELIgnored="false" %>
<html>
<head>
  <title>JSTL: Funciton -- fn:length</title>
</head>
<body bgcolor="#FFFFFF">
<h3>fn:length()</h3>
<hr>
<c:set var="s1" value="There is a castle on a cloud"/>
<%
 String[] customers = {"tom","johnson","jake"};
 session.setAttribute("customers",customers);
%>
<table cellpadding="5" border="1">
  <tr>
    <th align="left">Input String</th>
    <th>Result</th>
  </tr>
  <tr>
    <td>${s1}</td>
    <td>${fn:length(s1)}</td>
  </tr>
  <tr>
    <td>${customers}</td>
    <td>${fn:length(customers)}</td>
  </tr>
  <tr>
    <td>null</td>
    <td>${fn:length(undefined)}</td>
  </tr>
  <tr>
    <td>empty string</td>
    <td>${fn:length("")}</td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?