JSP (8) JSP Tags

Source: Internet
Author: User
Tags include
JS JSP Another important syntax is tags (tags). JSP tags are not used <%, but only the use of < characters. JSP tag is a bit like HTML tag. JSP tags can have a "start tag", a "tag body" and an "end tag." Both the start and end signs can use the name of the flag, all of which are circled within the < and > characters. The end sign is to add a backslash (/) character after the character <. The name of the sign has an embedded colon (:) character in it, where the section before the colon describes the type of the flag. Let's take an example:

<some:tag>

Body

</some:tag>

If the flag does not require a body, the start and end flags can be combined, such as:

<some:tag/>

Here we use a/> to replace the > character so that we can quickly end the flag without needing an entity. This syntax is the same as the XML one.

Flags can be divided into two types: one is reproduced from an external tag library, and the other is a predefined logo. The predefined flags start with the JSP: character. For example, Jsp:include is a predefined logo used to include other web pages.

In the previous tutorial we have learned "include directive". In fact, it is very similar to jsp:include. Instead of loading the text of the contained files in the original file, they invoke the included flags at run time. Here is an example of a jsp:include use:

<HTML>


<BODY>



Going to include hello.jsp...<br>



<jsp:include page= "hello.jsp"/>



</BODY>



</HTML>


Now change the "Jsp:include" in the above code to "Jsp:forward" to see what the difference is. In fact, these two predefined flags are very useful.

Give the practice in this section and write a JSP that will be based on a Boolean (Boolean) variable to a contained file. Here is a hint, to use HTML and scriptlets mixed programming to handle JSP flags.




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.