Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

body-content default value works.. need clarification

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There were many thread in this forum related to default value of body-content.

I tried few examples and have following question

If spec says <body-content> is mandatory, how am I be able to run custom tag without <body-content> in TLD

CASE 1:
Custom tag extends SimpleTagSupport
no <body-content> mentioned in TLD

Result:
HTTP status 500
The TLD for the class example.TextTag specifies an invalid body-content (JSP) for a SimpleTag.

This means by default it takes JSP as default value for body-content. Since SimpleTags cannot have scriptless, it says "JSP" is not a valid body-content.

CASE2:
Custom tag extends TagSupport
no <body-content> mentioned in TLD
JSP had expression within body of tag

Result:
Expression in body of tag got evaluated.

When expression got evaluated, it means <body-content> is JSP

Please clarify me on this.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This means by default it takes JSP as default value for body-content.


No, I think it depends on the container you are using. There is no default value for Simple Tags, so you have to set one explicitly. If you don't, results may vary depending on the container being used. Check this FAQ.
 
I've been selected to go to the moon! All thanks to this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic