Initial custom tag file tag

Source: Internet
Author: User

Test page index.jsp

1 <%--Use the TAGLIB directive to invoke and name custom tags--%>2 <%@ taglib Prefix="Mytags"Tagdir="/web-inf/tags"%>3 4 <HTML>5   <Head>6    <title>Test Set Indicator sign</title>7   </Head>8   <Body>9   <%--Using custom Tags--%>Ten       <Mytags:headFontColor= "#660099"> OneThis is the body of a custom label! Sometimes because the tag attribute is too long, even a piece of text.<BR> AIt's too ugly to put them in the start tag, and it's not conducive<Strong>Write</Strong>。<BR> - at this point, the advantages of the body will be reflected.  -       </Mytags:head> the   </Body> - </HTML>


Custom label file Head.tag

1     <%--here"Tag"directives are equivalent to those in the JSP"page"instruction--%>2     3     <!--encoding settings, not missing, otherwise garbled display -4     <%@ tag Pageencoding="UTF-8" %>5     6     <!--declares the type of label body content (no script is allowed), the default scriptless can be an expression, empty does not allow the body, tagdependent the body as plain text, -7     <%@ Tag Body-content="scriptless" %>8     9     <!--required sets whether a property must be declared, Rtexprvalue sets whether the property value can be an expression -Ten     <%@ attribute Name="FontColor"Required="true"Rtexprvalue="true"%> One      A     <Strong>Here is the test!</Strong><BR> -     <em> -         <FontColor= "${fontcolor}"> the          -             <!--get the contents of the tag body - -             <Jsp:dobody/>     -         </Font> +     </em>

Test results:

Initial custom tag file tag

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.