博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jstl的fn常用方法库
阅读量:4229 次
发布时间:2019-05-26

本文共 1247 字,大约阅读时间需要 4 分钟。

<center>
    fn:endsWith()方法判断某字符是否以指定的参数结尾<br>
    fn:startsWith()方法判断某字符是否以指定的参数开始<br>
<table>
    <c:forEach var="file" items="${files }">
        <tr>
            <td>${file.name }</td>
            <td>
            <c:choose>
                <c:when test="${fn:startsWith(file.name,'I')}">Intel</c:when>
                <c:otherwise>
                    <c:if test="${fn:endsWith(file.name,'.txt') }">
                        文本文件
                    </c:if>
                </c:otherwise>
            </c:choose>
    </c:forEach>
</table>
查找子字符串
fn:indexOf('filename.txt','.')=${fn:indexOf('filename.txt','.') }<br>
字符串分割<br>
<c:set value="${fn:split(header['accept'],',') }" var="names"/>
<c:forEach items="${names }" var="name">
    ${name }<br>
</c:forEach>
length()方法可取字符串、数组、集合的长度:<br>
"${pageContext.request.requestURL }"的长度:${fn:length(pageContext.request.requestURI) }<br>

</center>

演示效果:

fn:endsWith()方法判断某字符是否以指定的参数结尾
fn:startsWith()方法判断某字符是否以指定的参数开始

$360Section  
$Recycle.Bin  
.rnd  
360SANDBOX  
BOOTNXT  
Documents and Settings  
hiberfil.sys  
hp  
inetpub  
Intel Intel
pagefile.sys  
PerfLogs  
Program Files  
Program Files (x86)  
ProgramData  
Recovery  
swapfile.sys  
SWSetup  
System Volume Information  
SYSTEM.SAV  
Users  
WiFi_Log.txt 文本文件
Windows  
查找子字符串 fn:indexOf('filename.txt','.')=8

字符串分割

text/html

application/xhtml+xml

application/xml;q=0.9

image/webp

*/*;q=0.8

length()方法可取字符串、数组、集合的长度:

"http://localhost:8080/ELTest/index3.jsp"的长度:18

转载地址:http://bvjqi.baihongyu.com/

你可能感兴趣的文章
HTML Professional Projects
查看>>
Python Cookbook, Second Edition
查看>>
Java Extreme Programming Cookbook
查看>>
XSLT Cookbook
查看>>
Java Programming with Oracle JDBC
查看>>
Hack Proofing Your Network (Second Edition)
查看>>
XML Programming (Core Reference)
查看>>
Visual Studio .NET: The .NET Framework Black Book
查看>>
Best Kept Secrets in .NET
查看>>
SQL: The Complete Reference
查看>>
Wireless Network Hacks & Mods For Dummies
查看>>
Programming INDIGO
查看>>
.NET Development Security Solutions
查看>>
3ds Max 8 Bible
查看>>
Hack Proofing Your Web Applications
查看>>
Hack Proofing ColdFusion
查看>>
Routing TCP/IP, Volume II
查看>>
Unix Systems Programming: Communication, Concurrency and Threads, Second Edition
查看>>
Hack Proofing Your Network (Second Edition)
查看>>
XML Programming (Core Reference)
查看>>