Usage Summary of some JSTL core tags in JSP
I JSTL introduction JSTL (JavaServer Pages Standard Tag Library) is the standard specified by JCP (Java community process), which provides Java Web developers with a standard general tag function library. And El replace the traditional direct embedding of Java programs on pages (scripting) to improve program readability, maintainability and convenience. JSTL is mainly implemented by Jakarta project organized by Apache. The container must support servlet 2.4 and JSP 2.0 or above. JSTL download address: http://tomcat.apache.org/taglibs/standard/ , the latest version is JSTL 1.2, which is downloaded in this article 1. Installation: unzip jakarta-taglibs-standard-1.1 2. Zip, unzip the JSTL. Zip file in the Lib directory jar,standard. Jar is directly copied to the WEB-INF / lib / directory under the project (if MyEclipse is used, you don't need to copy these two files. MyEclipse has its own). Import the tag library: for example:
2、 JSTL common Tags: to use formatting tags in JSP pages, you must use the <% @ taglib% > instruction,
<%@ taglib prefex="c" uri=" http://java.sun.com/jsp/jstl/core " %>
1. < C: set > tag can store variables in JSP scope or JavaBean attributes
There are five formats:
(1)
Specify variable name and value
(2)
Save the value value to a variable in the scope
(3)
Store the data of the text content in a variable with the scope
(4)
Store the value value in the attribute of the target object.
(5)
Store the data of the text content in the attribute of the target object
2. < C: out > tags are used to display the contents of data. There are four formats and syntax
(1)
Specify the value to display through the value attribute
(2)
Whether to output the contents in value as is
(3)
Set the default value through the default property
(4)
Set default values through text content
3. < C: remove > is used to remove variables in the specified range
4. < C: if > tags are used to perform process control. There are two formats for < C: if > tags
(1) No ontology content
(2) With ontology content