首页 > 代码库 > jstl_fn方法库

jstl_fn方法库

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

1,startsWith,endsWith

    <c:if test="${fn:endsWith(param.aa, ‘end‘) }">
        ends
    </c:if>
    <c:if test="${fn:startsWith(param.aa, ‘start‘) }">
        start
    </c:if>

2,indexOf

    <c:set var="test" value="http://www.mamicode.com/${param.aa }" scope="application"/>
    <c:if test="${ fn:indexOf(test,‘hello‘) != -1 }">
        hello
        </c:if>

3split

    <c:set value="http://www.mamicode.com/${fn:split(header,‘,‘) }" var="headerList"/>
    <c:forEach var="item" items="${headerList }">
        ${item }<br/>
        </c:forEach>

技术分享

 

jstl_fn方法库