Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Tags & tld

 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers!Got a bit of problem in return type of tag methods.It states in the JSP1.2 Spec (pg 164 Tag Extension API) that
" If the TagLibraryDescriptor file indicates that the action must always have an
empty action, by an <body-content> entry of “empty”, then the doStartTag()
method must return SKIP_BODY. Otherwise, the doStartTag() method may
return SKIP_BODY or EVAL_BODY_INCLUDE. "
But if I try it out ie an empty tag & make the doStartTag() return EVAL_BODY_INCLUDE,then the code gives me no problem.
Also ,those of you who have the Manning book,their IfTag.java in chapter16 has following code :
if (condition)
return EVAL_BODY_INCLUDE;
else
return SKIP_BODY;
& the tld file has the <body-content> for that tag as empty.
Why is this so?
Also,if i put some junk values for the <body-content>(or for anthing in the tld)
ie <body-content>12345</body-content>
then it gives me no error & accepts the default value "jsp".
Any answers?
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whaaaaaaat? No answers?
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't rely too much on the behaviour of Tomcat, the exam is not testing your knowledge of Tomcat.
Check Chawla's mock: default body-content
Some Web containers are very tolerant.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vedhas, you're exactly right in that Tomcat is fairly lenient in this respect. I've been playing with Tomcat 5 recently and it's still the same.
Simon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic