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

regarding custom tags

 
Nagamalini Pampati
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ taglib uri="example" prefix="example" %>
<example:aTagWithBody>
<%="Body Content"%>
</example:aTagWithBody>
If the aTagWithBody handler extends from TagSupport and returns BodyTag.EVAL_BODY_BUFFERED from doStartTag(), what will the above page print?

Select 1 correct option.
a The tag handler class would not compile.


b An exception at request time.


c "Body Content" will NOT be printied.


d "Body Content" will be printied.


e None of these.

given answer is "b".i thought it's "a".please explain this.
Thanks in Advnace,
Malini
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The doStartTag() function returns an int. It is not legal to return anything other than EVAL_BODY_INCLUDE and SKIP_BODY at runtime (assuming only TagSupport was extended), but nothing should stop you from returning -1 or 999 from the function. The BodyTag.EVAL_BODY_BUFFERED constant is also an int and it can be returned from this function. But at runtime this is not a legal value and thus you get a RuntimeException.
[ October 24, 2006: Message edited by: John Meyers ]
 
Nagamalini Pampati
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but if instead of having BodyTag.EVAL_BODY_BUFFERED if we have only EVAL_BUFFERED will that result in compilation error?

Thanks in Advance,
malini
 
Nagamalini Pampati
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry its EVAL_BODY_BUFFERED instesd of EVAL_BUFFERED in my previous question...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic