JSP (8) -- JSP tags

Source: Internet
Author: User

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.

Related Article

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.