• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BodyContent() doubt

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sourin K. Sen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic