This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help for f nice question

 
Gaurav Chugh
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
i would like to discuss a question here , it as follows
Consider the following code for doStartTag() method of a tag handler.
public int doStartTag()
{
int retval = Tag.EVAL_BODY_INCLUDE;
try
{
Statement stmt = getConnection().createStatement();
ResultSet rs = stmt.executeQuery("select * from USERS");
if(rs == null | | !rs.next() ) retval = Tag.SKIP_BODY;
else doSomethingWithRS();
}
catch(Exception e)
{
retval = XXXXX; // 1
}
return retval;
}

In case of an exception you do not want the doEndTag() of this tag handler to be called. What value should be used at // 1 to satisfy this requirement?
the following options can be
1>Either it should return Tag.SKIP_BODY
2>Still we go the exception We can avoid doEndTag() to implement method at //1
3>None of These .
cud anybody explain which option is correct
Thanks in advance


------------------
with warm regards
..gaurav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic