Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Ranch Hand
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bindu Lakhanpal
Ranch Hand
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have to know which constant can be returned. There is no container dependent question at the exam.
 
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic