<1> implementation methods
Generally, two types of tags are used: the body part and the body part.
-- To implement tags without the body part, you must inherit the tagsupport class and implement the dostarttag () and doendtag () methods.
-- To customize tags that contain the body part, you must inherit the tagsupport class or bodytagsupport class. Generally, the latter is used. Although tagsupport can also be used, bodytagsupport inherits tagsupport, which is more suitable for handling parts containing the body. Implementation methods include dostarttag (), setbodycontent (bodycontent), doinitbody (), doafterbody (), and doendtag ()
Execution Process:
1> after the container creates a new tag instance, it uses setpagecontext to set the Page Context of the tag.
2> use the setparent method to set the upper-level label of this label. If there is no upper-level nesting, set it to null.
3> set the tag attribute, which is defined in the tag library description file. If no attribute is defined, this method is not called.
4> call dostarttag () when encountering a specified tag (). If skip_body is returned, the doendtag () is called directly without processing the TAG body. If eval_body_buffered is returned, the body is processed.
5> call setbodycontent () to set the current bodycontent
6> call doinitbody (). If some Initialization is required during bodycontent calculation, perform the initialization in this method.
7> call doafterbody () after processing the body. If eval_body_tag is returned, the system continues to calculate the body once. Only when the skip_body is returned will the system continue to execute the code.
8> call the doendtag () method. This method can return eval_page or skip_page. When eval_page is returned, the container continues to compute other parts of the JSP page when the Tag ends. If skip_page is returned, the container stops computing other parts of the JSP page when the Tag ends.
9> call the release () method to release any resources occupied by the tag Program
<2> return value description
Skip_body indicates that the doendtag () method is called directly without processing the TAG body.
Skip_page ignores the JSP content behind the tag
After eval_page processes tags, it continues to process content following JSP
Eval_body_buffered indicates the TAG body to be processed.
Eval_body_include indicates that the label body needs to be processed, but the setbodycontent () and doinitbody () methods are bypassed.
Eval_body_again processing the TAG body Loop
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.