Jstl has been used before, for example, <C:URL>,FN is the functionlibrary of Jstl, and C is the tag library of Jstl. Using them, we'll tell the parser as follows:
<%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix=
"FN" uri= "http://" Java.sun.com/jsp/jstl/functions "%>
These directive are equivalent to the following. Although prefix (or namespace) can be set to different, we should follow the recommendations in the TLD (Tag Library descriptor) to make it easier for others to read.
<jsp:root xmlns= "http://www.w3.org/1999/xhtml" version= "2.0" xmlns:jsp= "Http://java.sun.com/JSP/Page"
xmlns:c= "Http://java.sun.com/jsp/jstl/core"
xmlns:fn= "Http://java.sun.com/jsp/jstl/functions" >
In the JSP file, JSP tag is default, that is, no need to give prefix (namespace), of course, can also be written as <jsp:include>,<jsp:forward>.
Note that the URI is the name of the Convention, not the real URL, only used as a unique identifier for the TLD. When the JSP parser encounters the taglib directive, it is necessary to obtain the tag library's TLD file using the URI. The parser first searches the Java EE container's jave EE specification TLD files, including JSP Taglibrary,jstl, and JavaServer Faces libraries; second, check in Web.xml in < The <taglib>; in jsp-config> is then checked to see if the jar file in the application/web-inf/lib also has a TLD file, or a TLD file under/web-inf or its subdirectories , and finally check whether the TLD that is encapsulated as a Web container or the Application Server section (this is usually a custom web container that makes the application and Web container bound and cannot be ported).
For the second customization, the following:
<jsp-config> ...
<taglib>
<taglib-uri>http://www.example.org/xmlns/jsp/custom</taglib-uri>
< Taglib-location>/tld/custom.tld</taglib-location>
</taglib> ...
</jsp-config>
Tomcat server does not support JSTL, so it is necessary to introduce in Maven's Pom.xml file that the Lib Jar approach provides jstl support. Note that the <scope> here is compile rather than provided, because Tomcat does not contain the associated libraries.
<dependency> <groupId>javax.servlet.jsp.jstl</groupId> <artifactid>javax.servlet.jsp.jst l-api</artifactid> <version>1.2.1</version> <scope>compile</scope> </depend ency> <dependency> <groupId>org.glassfish.web</groupId> <artifactid>javax.servlet.js p.jstl</artifactid> <version>1.2.2</version> <scope>compile</scope> <exclus ions> <exclusion> <groupId>javax.servlet</groupId> <artifactId> servlet-api</artifactid> </exclusion> <exclusion> <GROUPID>JAVAX.SERVL et.jsp</groupid> <artifactId>jsp-api</artifactId> </exclusion> <exc Lusion> <groupId>javax.servlet.jsp.jstl</groupId> <artifactid>jstl-api</ar Tifactid>;/exclusion> </exclusions> </dependency>
There are 5 tag libraries in the JSTL, the distribution is: Core (c) Formatting (FMT) functions (FN) SQL (SQL) XML (x)
Please refer to the syntax: http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/. There are no 1.2 documents available, but the differences are small. In general, it is not recommended to use SQL and XML.
RELATED links: My professional Java for WEB applications related articles