Another important Syntax of JSP is Tags (TAG ). JSP Tags does not use <%, but only the <character. JSP Tag is a bit like HTML Tag. JSP tags can have a "start tag", a "tag body", and an "end tag ". The names of the start and end signs can be enclosed in the <and> characters. The ending sign is followed by a backslash (/) character. The flag name contains an embedded colon (:) character, in which the part before the colon describes the type of the flag. For example:
<Some: tag>
Body
</Some: tag>
If a flag does not require a subject, the start and end signs can be merged. For example:
<Some: tag/>
Here we use a/> to replace the> character, so that we can quickly end the sign without needing an entity. This syntax is the same as that of XML.
A flag can be divided into two types: one is reprinted from the external flag library, and the other is pre-defined. The predefined flag starts with a jsp character. For example, jsp: include is a pre-defined sign used to include other web pages.
In the previous tutorial, we have learned "include ctictive ". In fact, it is very similar to jsp: include. They do not load the text of the contained file in the original file, but call the included flag at runtime. The following is an example of jsp: include:
<HTML>
<BODY>
Going to include hello. jsp... <BR>
<Jsp: include page = "hello. jsp"/>
</BODY>
</HTML>
Change "jsp: include" in the above Code to "jsp: forward" to see what their differences are. In fact, these two pre-defined labels are very useful.
Next, let's take a look at the exercises in this section. Compile a JSP that uses a boolean variable to pair an contained file. Here, I 'd like to remind you that we need to use the hybrid programming of HTML and scriptlets to process JSP labels.