BodyTagSupport execution sequence
Methods for loading the BodyTagSupport class:
When writing the implementation class corresponding to the label, you need to reload several methods of the BodyTagSupport class: doStartTag (), setBodyContent (), doInitBody (), doAfterBody (), doEndTag ();
Their execution order is as follows:
DoStartTag () → doInitBody () → setBodyContent () → doAfterBody () → doEndTag ()
The doStartTag () method returns EVAL_BODY_INCLUDE or SKIP_BODY,
If EVAL_BODY_INCLUDE is returned, the execution continues;
If SKIP_BODY is returned, the following doInitBody (), setBodyContent (), and doAfterBody () methods will not be executed,
Directly execute the doEndTag () method.
The setBodyContent () method is used to set the content of the TAG body. If Initialization is required before this, it is completed in the doInitBody () method.
After the label body content is executed, the doAfterBody () method is called. This method returns EVAL_BODY_TAG, SKIP_BODY,
EVAL_PAGE or SKIP_PAGE.
If EVAL_BODY_TAG is returned, the TAG body is set again until SKIP_BODY is returned;
If EVAL_PAGE is returned, the following parts of the JSP page will be executed after the label body is executed;
If SKIP_PAGE is returned, the subsequent content of the JSP page will not be executed.
Static constants in the Tag:
EVAL_BODY_INCLUDE: tells the server body content and sends the content to the output stream.
SKIP_BODY: tells the server not to process the body content
EVAL_PAGE: allows the server to continue executing the page
SKIP_PAGE: prevents the server from processing the remaining page
EVAL_BODY_AGAIN: Let the server continue to process the body content. Only the doAfterBody method can return
EVAL_BODY_BUFFERED: Field of the BodyTag interface, which is returned in doStartTag ().
EVAL_BODY_INCLUDE and SKIP_BODY are generally returned by doStartTag (), while EVAL_PAPGE and SKIP_PAGE are returned by doEndTag ().
From the path of the mouse programmer