This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes doStartTag() retun Type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "doStartTag() retun Type" Watch "doStartTag() retun Type" New topic
Author

doStartTag() retun Type

mallika shah
Ranch Hand

Joined: May 11, 2006
Posts: 164
Hello all,
here is a question,

public class ForumTagHandler extends TagSupport {
private int totalTopics = 0;
public int doStartTag() throws JspException {
if (totalTopics > 40)
return EVAL_BODY_AGAIN;
else
return SKIP_BODY; }}


options are -

1. The body of the tag is evaluated again.
2. The body of the tag is skipped.
3. SKIP_BODY is not a valid return code.
4. EVAL_BODY_AGAIN is not a valid return code.
5. JspException is not handled in the doStartTag() method.

The ans is given 4..
I dont understand why so..as the condition is false it should return skip_body ...

one more thing,isint Eval _body_Include a valid return type of doStartTag()?? as this class inherits this field from Tag Interface...

mallika
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

EVAL_BODY_AGAIN is a return value of doAfterBody(), not doStartTag()


[My Blog]
All roads lead to JavaRanch
Tridib Samanta
Ranch Hand

Joined: Apr 28, 2004
Posts: 128
Hi Mallika,
EVAL_BODY_AGAIN is a valid return type for doAfterBody() method. Although in this case there will not be any compilation error, concepually you should not return EVAL_BODY_AGAIN from doStartTag().


Thanks, Tridib
SCJP 1.4, SCWCD 1.4, SCBCD 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doStartTag() retun Type
 
Similar Threads
j2eeCertificate(custom tag ) ques
Classic tag error
Is returning invalid integer from doStartTag() is equivalent to returning EVAL_BODY_INCLUDE ?
behaviour of doStartTag of TagSupport
Question and answer from j2eecertificate.