Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doStartTag MUST return SKIP_BODY

 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

From HFSJ page 564

If the TLD for a tag declares an empty body,
doStartTag() MUST return SKIP_BODY!


I have declared a classic custom tag with
<body-content>empty</body-content>

In TagHandler, I return EVAL_BODY_INCLUDE from doStartTag() method.
Even I don't get any exception.

Is it container related ?

Can we expect questions related this in the Exam ?


Thanks
Kathir
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look closely at the specification JSP.13.1 Classic Tag Handlers, you'll see many times the following :
If the TagLibraryDescriptor file indicates that the action must always have an empty element body, by a <body-content> entry of "empty", then the doStartTag() method must return SKIP_BODY.

JSP.13.2.2 BodyTag also says :
If EVAL_BODY_INCLUDE is returned, and the custom action element is not empty, setBodyContent() is not invoked, doInitBody() is not invoked, the body is evaluated and "passed through" to the current out, doAfterBody() is invoked and then, after zero or more iterations, doEndTag() is invoked. If the custom action element is empty, only doStart() and doEndTag() are invoked.

So, I think the container should generate an error if doStartTag() does not return SKIP_BODY when body-content is set to empty. However, it should be ok when an empty body is used with a body-content set to something different than "empty". I'd like to say that it's a container issue, but I'm not 100% sure.
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I thought so.

Thank you for timely help
Kathir
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic