This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Is returning invalid integer  from doStartTag() is equivalent to returning  EVAL_BODY_INCLUDE ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Is returning invalid integer  from doStartTag() is equivalent to returning  EVAL_BODY_INCLUDE ?" Watch "Is returning invalid integer  from doStartTag() is equivalent to returning  EVAL_BODY_INCLUDE ?" New topic
Author

Is returning invalid integer from doStartTag() is equivalent to returning EVAL_BODY_INCLUDE ?

Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 165

If i return invalid integer value from doStartTag() in following code,no exception occurs,which is understandable since return type of doStartTag() is integer.But what i got as output is as if EVAL_BODY_INCLUDE (which is equal to 1)is returned.


The out put is as follows:

in doStartTag with 23(invalid) return value This is tag body which can be jsp -----in doAfterBody-----in doEndTag
Is it container specific behaviour ( I am using Tomcat )or is it what jsp spec says?
Even if i return other values like SKIP_PAGE (which is valid for doEndTag()), i got same output as above.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I don't think that it's explicitly written in the spec. I think it's container dependent, so you'd better be sure to return the correct value.


[My Blog]
All roads lead to JavaRanch
Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 165

Ok.Thanks.

If i returned invalid integer from doAfterBody(),it behaved as if SKIP_BODY is returned.
Returning invalid integer from doEndTag() gave output as if EVAL_PAGE is returned.
These are default return values unlike EVAL_BODY_INCLUDE in case of doStartTag().

If such a question comes in exam(although probability is low),should the answer be "container dependent"
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I think you have to know which constant can be returned. There is no container dependent question at the exam.
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Bindu.
Make sure that we should not return the value '0'(which is default return value of SKIP_BODY) in doStartTag(). If we return, the body will not be evaluated. Tomcat will checks that condition.
Tomcat is not performing may conditional checks incase of ClassicTags. If they performs, if affect on performance.
 
jQuery in Action, 2nd edition
 
subject: Is returning invalid integer from doStartTag() is equivalent to returning EVAL_BODY_INCLUDE ?