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

valid return value of doStartTag()??

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following JSP code from Enthuware Mock:

<mylib:MyIterTag>
<%="Hello World"%>
</mylib:MyIterTag>

If the tag handler class for MyIterTag implements IterationTag and returns IterationTag.EVAL_BODY_BUFFERED from doStartTag(),
what will be output in the response?

1. Hello World
2. <%="Hello World"%>
3. The tag handler will not compile.
4. The tag handler will compile but throw an exception at request time.
5. No compile-time or run-time erros and nothing will be printed in the output.

the correct answer is 3. I don't understand how this result a compile time error.. complier check for the valid return values NOT for the types of return values. I think compiler check weather doStartTag() method returns int or not. What type of a int value it should return , it will check on the request processing time indeed..


Please correct me if i am wrong.


Thanks

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the a constant called EVAL_BODY_BUFFERED in IterationTag ?
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:Is the a constant called EVAL_BODY_BUFFERED in IterationTag ?


Nope! constant called EVAL_BODY_BUFFERED declared in BodyTag interface not iterationTag.

iterationTag declares EVAL_BODY_AGAIN

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic