Web Basics (V)----JSTL Technology

Source: Internet
Author: User
I. Overview of JSTL

JSTL (JSP Standard Tag Library), JSP standard tag libraries, can be embedded in the JSP page using the form of tags to complete the business logic and other functions. The purpose of Jstl appears to be the same as El to replace the script code in the JSP page. JSTL standard standard Tag Library has 5 sub libraries, but with the development, it is often used in his core library


Second, Jstl download and import

Jstl Download:
Download the Jstl jar package from the Apache Web site. Go to the "http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/" url to download the JSTL installation package. Jakarta-taglibs-standard-1.1.2.zip and then unzip the downloaded JSTL installation package, at which point you can see two jar files in the Lib directory, Jstl.jar and Standard.jar respectively. Where the Jstl.jar file contains the interfaces and related classes defined in the JSTL specification, Standard.jar file contains the. class file for implementing Jstl and the 5 tag library descriptor files (TLD) in Jstl


Import two jar packages into the lib of our project
Import the core tag library using the JSP's taglib directive


third, Jstl Core library of the common label 1 <c:if test= "" > Label
Where test is a condition that returns a Boolean
2) <c:forEach> label
There are two combinations of ways of using:

<%@ page language= "java" contenttype= "text/html;
Charset=utf-16 "pageencoding=" UTF-16 "%> <%@ taglib uri=" Http://java.sun.com/jsp/jstl/core "prefix=" C "%> <!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" > Operation Effect:


<%@ page language= "java" contenttype= "text/html; Charset=utf-16 "
	pageencoding=" UTF-16 "%>
<%@ page import=" java.util.* "%>" <%@ taglib "uri=
" Http://java.sun.com/jsp/jstl/core "prefix=" C "%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >



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.