JSP--JSTL (JSP Standard Tag Library)

JSP--JSTL (JSP Standard Tag Library)

Blog description

The information involved in this article comes from Internet collation and personal summary, which means personal learning and experience summary. If there is any infringement, please contact me to delete, thank you!


JavaServer pages tag library JSP standard tag library

Is an open source free jsp tag provided by the Apache organization


Used to simplify and replace java code on jsp pages


Rookie tutorial document address https://www.runoob.com/jsp/jsp-jstl.html

Download address

Download the jakarta-taglibs-standard-1.1.2.zip package and extract the two jar files under jakarta-taglibs-standard-1.1.2/lib / standard.jar And jstl.jar Copy the file to / WEB-INF/lib /.

Copy the tld file to be imported under tld to the WEB-INF directory.

Next, we will web.xml Add the following configuration to the file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 

Use steps

  1. Import jstl related jar package
  2. Import tag library: taglib instruction:

    <%@ taglib %>
  3. Use labels

Common JSTL Tags

If -- if statement equivalent to java code
  1. Properties:

    • test must be attribute, accept boolean expression

      • If the expression is true, the if label body content is displayed; if it is false, the label body content is not displayed
      • In general, the test property value is used in conjunction with the el expression
  2. be careful:

    • c:if tag has no else situation. If you want else situation, you can define a c:if tag
choose -- switch statement equivalent to java code
  1. Using a choose tag declaration is equivalent to a switch declaration

    1. Using the when tag for judgment is equivalent to case
    2. Using the other way tag to make other statements is equivalent to default
foreach -- for statement equivalent to java code


Rookie tutorial

Black horse programmer

Omnipotent network

And the industrious self

Tags: Java JSP xml SQL

Posted on Sun, 28 Jun 2020 02:19:01 -0400 by wing_zero