Common Jstl Tags
One, <%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%> core tags
1, match the conditions on the output, there is no corresponding else
<c:if test= "conditions" > Output content </c:if>
2, meet a certain conditions, no longer perform the following conditions, no conditions suitable for the execution of otherwise
<c:choose>
<c:when test= "Condition 1" > Output content </c:when>
<c:when test= "Condition 2" > Output content </c:when> ...
<c:otherwise> Output Content </c:otherwise>
</c:choose>
3, if the element name in the Map,var may get the corresponding value through the key and the Value property
<c:foreach items= "Array or collection" Var= "the element name of an array or collection" >
Output results
</c:forEach>
4, the string is delimited, the default is a comma
<c:fortokens items= "string" var= "element name" delims= "delimiter" >
<div>${item}</div>
</c:forTokens>
5. Exception Handling
<c:catch var= "Exception variable name" >
Code snippet that could produce an exception
</c:catch>
6. Output
<c:out value= "${exception variable name. Message}" ></c:out>
7, set properties, scope range order page, request, session, application, if not in the page range created
<c:set var= "Property name" value= "value" scope= "range" ></c:set>
Add a property or attribute assignment to a javabean or map
<c:set vulue= "Value" property= "Property name" target= "JavaBean or map" ></c:set>
<c:set ...>
The value can also be written here
</c:set>
8, delete attributes, scope does not specify in order to find
<c:remove var= "Login" scope= "session"/>
9, equivalent to Jsp:include function
<c:import url= "Address" >
<c:param name= "Variable 1" value= "value" ></c:param> ...
</c:import>
10. redirect
<c:redirect url= "get.jsp" >
<c:param name= "Variable 1" value= "value" ></c:param> ...
</c:redirect>
11. Equivalent to Response.encodeurl method
<c:url value= "Address" ></c:url>
Ii. <%@ taglib prefix= "FMT" uri= "http://java.sun.com/jsp/jstl/fmt"%> formatting tags
1, output a specific format
<fmt:formatdate value= "Time value" pattern= "format"/>
The format can be # or 0 to replace one, if it is #, the first digit of the integer 0 and the decimal point of the last 0 does not show that the fractional part is not enough to round the number of digits
<fmt:formatnumber value= "number" pattern= "format" ></fmt:formatNumber>
2. Convert to date format and number format output
<fmt:parsedate value= "value to convert" pattern= "format" ></fmt:parseDate>
<fmt:parsenumber value= "value to convert" pattern= "format" ></fmt:parseNumber>
Third, <%@ taglib prefix= "FN" uri= "http://java.sun.com/jsp/jstl/functions"%> el function library
1. The function library of the El expression, used in the EL expression
Fn:length (String) Gets the length of the string, combined with the length of the Jstl label output string
<c:out value= ' ${fn:length (String)} ' ></c:out>
More detailed usage refer to JSTL manual!