• 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
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

doStartTag() retun Type

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EVAL_BODY_AGAIN is a return value of doAfterBody(), not doStartTag()
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
There will be plenty of time to discuss your objections when and if you return. The cargo is this 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
reply
    Bookmark Topic Watch Topic
  • New Topic