First, JSP tags (provided by sun Company)
Two, El expression
Third, Jstl (JavaServer Pages standard Tag library)
1. Why should there be jstl
The JSP tag is too weak, the El expression function is incomplete (such as cannot traverse the collection), all have jstl. The purpose is to cooperate with Jsp+el in the way of embedding Java code in JSP to improve the readability, maintainability and convenience of the program.
2. Jstl Essence and principle
The implementation of JSTL is equivalent to invoking a Java method in an El expression. First, define a class that contains a static method, define a TDL file to describe the function, and then reference the file with the Tablib directive on the page, and then you can call the function by prefixing it with a colon.
3.JSTL Five types of libraries (core tag libraries, internationalized tag libraries, database tag libraries, XML tag libraries, JSTL functions, where SQL tag libraries and XML tag libraries are not commonly used so do not learn)
3.1 Core Tag Library
3.1.1 C:out
3.1.1.1 Output Constants
3.1.1.2 Output variable
3.1.1.3 output default value (output default value if value is not value)
The 3.1.1.4 HTML Escape Output Ps:escapexml property controls whether to escape output by default value True
The JSP code is as follows:
<%@ page language= "Java"Import= "java.util.*" pageencoding= "Utf-8"%><%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%><%String Path=Request.getcontextpath (); String BasePath= Request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >; Pagecontext.setattribute ("Name", name); %> <c:out value= "${name}" ></c:out> default= "Obama (this is the default value)" ></c:out> <c:out value= "${name1}"default= "Obama (this is the default value)" ></c:out> View CodePage effect:
3.1.2 C:set
3.1.2.1 setting or modifying the value of a property in a field
3.1.2.2 setting or modifying the attribute values of a map in a field
3.1.2.3 setting or modifying JavaBean property values in a field
3.1.3 C:remove Remove the value of a property in a domain
3.1.4 C:catch Catch exception
Wisdom Podcast Javaweb Day06-jstl