Specifies the format for the body of this tag. The default in JSP 1.2 was "JSP" but because this is an invalid setting for simple tag handlers, there is no longer a default in JSP 2.0. A reasonable default for simple tag handlers is "scriptless" if the tag can have a body.
One doubt here: I have verified the scenario on Websphere(WAS) 6.1 and Tomcat 5.5. Both of them are able to default the body-content(if absent in TLD) like this WAS done like this: "JSP" for custom tags, "scriptless" for simple tags.
Tomcat done like this: "JSP" for both custom and simple tags.
So How we should treat this scenario( absence of body-content) in exams.
Take it grated that it works bec'ze container provider's are defaulting based on class mentioned. (or) Select translation error.
Any questions or suggestions please reply.
[ August 18, 2007: Message edited by: Srinivasan thoyyeti ] [ August 19, 2007: Message edited by: Srinivasan thoyyeti ]
for classic tags, JSP for simple tags, scripless should be the defaults. (no single default value as it was in 1.2)
Reality is that there is no default as such for JSP 2.0 tags, neither for simple nor for classic.
Default is only for <body-content> element in tld. And that is JSP.
If you define a simple tag and don't declare <body-content> element for it in tld, you will get a translation error because by default, it's JSP which is not allowed for simple tags. You can even try this.
Yes, there is default for tag files and that is scriptless.
Point 1. Christophe, yet things are not clear. please look into exam point of view. its complex.
Christophe Verre posted: There is no default value for the body-content, that's all you need to remember. If you remember what's in this faq, then you should be ok.
According to specification body-content must be specified(MANDATORY) in the TLD in JSP 2.0. (and there are no defaults)
Shall we select compilation(translation) error if body-content is missing from the TLD. ------------------------------------------------------------------ Point 2: Why I am able to run both custom, simple tag handlers with out having <body-content> declaration in TLDs on WAS 6.1.
in WAS its able to defalut <body-content> (if absent in TLD) for both cutom,simple tag tlds as "JSP" and "scriptless" respectly. ------------------------------------------------------------------------ Point 3: Tomcat is still initializing in the old way( see JSP 1.2 for TLD). Irrespective of tag used if <body-content> absent its defaulting to JSP.
I am here to confirm that TOMCAT 5.5 is not following <body-content> requirements of JSP 2.0.
3.1 Here is my tld:
3.2 Here is the error it has thrown:
The TLD for the class edu.jsp.simpleTag.ListMovies specifies an invalid body-content (JSP) for a SimpleTag.
Please understand what kind of puzzle we are in. Please give me a convincing answer. [ August 19, 2007: Message edited by: Srinivasan thoyyeti ]
Sorry Srinivasan, I was only answering in the scope of the exam
I've seen other threads already discussing this, and you'd probably find them too if you search for it. Some container providers may have decided to set a default value for the body tag content, but as far as the spec is concerned, there is no default value, so you should set one. If you assume that Tomcat is setting it to JSP, and you're ok with, then you may run into trouble if you decide to port your application to another container.
If you get out of scope of the exam at this stage, you'll find it difficult to remember which was right from wrong when you pass the exam. That's why I only wanted to tell to remember what the fact is.
Shall we select compilation(translation) error if body-content is missing from the TLD.
If there were such a question at the exam, it would be straight forward. It will not leave you wondering if it's a translation error or not.
Why I am able to run both custom, simple tag handlers with out having <body-content> declaration in TLDs on WAS 6.1.
Refer to WAS documentation, or contact their support center. They may have decided to set a default value.
Please understand what kind of puzzle we are in.
I'm answering your first question : "So How we should treat this scenario( absence of body-content) in exams." Answer is : there is no default.
Remember that those containers are not considered to be reference implementations. You have to remember what is in the faq, not what WAS or Tomcat do. If you want to understand what Tomcat does, your thread would be more appropriate in the Tomcat forum
According to the schema the tag body-content is mandatory.
So a tag "tag" without the tag "body content" should fail in the schema validation itself, it would have been wise if the message is given by the vendors instead of assuming some default value. It would have avoided all the confusion.