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>
Now set the aboveCodeIn, change "JSP: Include" to "JSP: Forward" to see their differences. 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.