JSTL c tag, fn label, FMT label-live on the island of Java-Iteye technology website

Source: Internet
Author: User
Tags tld

Jstl is a sun-defined standard, implemented by Apache, so to download the jar package to Apache, to see the API documentation, go to SUN,API document here: HTTP://JAVA.SUN.COM/PRODUCTS/JSP/JSTL/1.1/ Docs/tlddocs/index.html
<%@ taglib prefix= "FN" uri= "Http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix= "FMT" uri= "Http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%>

C Tag Library Use does not introduce, simple write down a few common

1, C:fortokens
Similar to the Split function in JS and Java, a string is divided into groups of characters and processed one by one. Items is the original string to be processed, Delims is the delimiter
<c:fortokens var= "Item" items= "www.trs.com.cn" delims= "." >
${item}<br/>
</c:forTokens>

2, Fmt.tld more useful fmt:parsedate, Fmt:formatdate, Fmt:parsenumber, Fmt:formatnumber, used to format time and numbers, examples are as follows:
<fmt:formatdate value= "${item.createdtime}" pattern= "Yyyy-mm-dd hh:mm"/>

3, the function of Fn.tld,jstl, which has
Fn:contains determine if a string contains another string, eg <c:if test= "${fn:contains (str, searchstring)}" >;
Fn:containsignorecase with the above tag, just not the case-sensitive;
Fn:endswith determines whether a string ends with a word, eg <c:if test= "${fn:endswith (filename,". txt ")}" >
Fn:escapexml converts a string to a string that does not have an XML unrecognized character, eg ${fn:escapexml (info)}
Fn:indexof determines the position of a character in a string, eg ${fn:indexof (name, "-")}
Fn:join with Jsjoin, the array is spliced with characters, eg ${fn:join (array, ";")}
Fn:length calculating the length of a string
Fn:replace Replace a string, eg ${fn:replace (text, "-", "?")}
Fn:split join reverse process, eg ${fn:split (Customernames, ";")}
Fn:startswith whether to start with a string, eg <c:if test= "${fn:startswith (product.id," 100-")}" >
Fn:substring get string, eg ${fn:substring (zip, 6,-1)}
Fn:substringafter starts a string from a string, eg ${fn:substringafter (Zip, "-")}
Fn:substringbefore the reverse process of the previous article
Fn:touppercase to capitalize all characters in a string
Fn:trim remove spaces on both sides of the string, eg ${fn.trim (name)}



From for notes (Wiz)

JSTL C tags, fn tags, fmt tags-live on the island of Java-Iteye technology website

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.