Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
My pie came with a little toothpic holding up this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic