Forums Register Login

BodyContent() doubt

+Pie Number of slices to send: Send
From the JSP 2.0 specification:-

public abstract class BodyContent extends JspWriter

An encapsulation of the evaluation of the body of an action so it is available to a
tag handler. BodyContent is a subclass of JspWriter.
Tag Handlers that want Access to their Body Content


Can anybody Please explain me the what dose it mean to the line in Bold???


Thanks
+Pie Number of slices to send: Send
It simply means that whatever is there inside the tag body, is evaluated (if EL is present and rtexprvalue is true) and then available to us (indide the doTag method) via BodyContent for further processing of that content. If we dont use BodyContent and pass null to getJspWriter().invoke() method, then the body will be written to the response stream straight away without giving us a chance of processing.

this is particularly useful for Simple Tags where you dont have any specialized methods to access the body directly unlike the Classic tag's BodyTag interface which gives us a complete method where we can get the body and process it.
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 621 times.
Similar Threads
EVAL_BODY_BUFFERED question
Accessing Tag Body in Classic Tag
Mock Exam Question - related to doAfterBody
doAfterBody() is not executed using BodyTagSupport
Creating Custom Tags using BodyTagSupport
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:23:07.