TagLib application in JSP (4-3)

Source: Internet
Author: User

The Custom Tag (Custom tags) implements javax. servlet. jsp. tagext. Tag or javax. servlet. jsp. tagext. BodyTag.

Interface. Use javax. servlet. jsp. JspWriter to output.

The TagSupport class provides implicit implementation of the interface Tag. serialization and data sending.

Public class TagSupport extends java. lang. Object implements Tag, java. io. Serializable

BodyTagSupport class provides implicit implementation of interface BodyTag. inherits TagSupport

Public class BodyTagSupport extendsTagSupport implements BodyTag

When writing tag handler, We need to inherit the TagSupport class or BodyTagSupport class, and then reload doStartTag () and doEndTag ().

You can also further separate them and put the specific implementation in the bean.

The class of these custom labels should be placed in the WEB-INF/classes or WEB-INF/lib

Finally, package custom tag libraries into A. war file. For the. war file, the resource structure is shown in.



Control the ing by using the deployment descriptor.

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.