• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

body-content

 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Source is jdiscuss mock
For a tag to accept any valid jsp code as its body, what should be the value of <body-content> for this tag's taglib descriptor?

A.JSP
B.jsp
C.any
D.text
E.The <body-content> subelement itself may be absent.

Correct answer is E.

But I think the answer is A.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chintu sirivennela:
But I think the answer is A.



i also Agree. any update on This?
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


if you are choosing A as answer, your tag should be a classic tag handler.
Here they have declared only the Tag. So JSP shouldnt be the answer.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Dheepa
 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried with tomcat.

My findings are

without the body-content element in tld

Classic Tag handler

-- evaluating the Scripting elements.

Simple Tag Handler

-- Runtime Error.
The TLD for the class <ClassName> specifies an invalid body-content (JSP) for a SimpleTag.


-- Runtime Error
Scripting elements ( <%!, <jsp eclaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here.
[ August 19, 2008: Message edited by: deepa raj ]
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simple tag does not allow body ?since when it started?
 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks deepa raj , So what would be the answer then..
 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any update on this ??

Can some body please clarify "Leave it blank " option .
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answer is A (JSP). The question implies that it is about classic tags.

E is wrong, since the body-content tag is mandatory. See specs.
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepa, great that you tested it. But I have some questions about it.

Originally posted by deepa raj:
I have tried with tomcat.

My findings are

without the body-content element in tld

Classic Tag handler

-- evaluating the Scripting elements.

...[ August 19, 2008: Message edited by: deepa raj ]



This surprises me, since the body-content tag is mandatory.



Originally posted by deepa raj:

...
Simple Tag Handler

-- Runtime Error.
The TLD for the class <ClassName> specifies an invalid body-content (JSP) for a SimpleTag.


-- Runtime Error
Scripting elements ( <%!, <jsp eclaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here.

[ August 19, 2008: Message edited by: deepa raj ]



What do you mean by runtime error? Doesn't the container give an error at startup?


Regards,
Jan
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
body-content is optional see specs:

Simple Tags:
Table JSP.8-2 Details of tag directive attributes

body-content (optional) Provides information on the content of the body of
this tag. Can be either empty, tagdependent, or scriptless. A
translation error will result if JSP or any other value is used.
Defaults to scriptless.


This for Classic Tags:
tagdependent The body of the tag is interpreted by the tag implementation itself,
and is most likely in a different �langage�, e.g embedded SQL statements.
JSP The body of the tag contains nested JSP syntax
empty The body must be empty
This element is optional; the default value is JSP


Thanks and Regards
Joy
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joy,

At what page, and from which specs version exactly did you get that?

The diagram at page 3-25 of JSP 2.1 specs indicates that name, tag-class and body-content are mandatory elements. The optional ones (like attribute and tei-class) have either a * or an ? next to their name.
 
Joy Mukherjee
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it from
jsp-2_0-fr-spec.pdf

Search with body-content and you will see the text I copy pasted.


Thanks and Regards
Joy
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Joy, got the specs.

Simple Tags:
Table JSP.8-2 Details of tag directive attributes

body-content (optional) Provides information on the content of the body of
this tag. Can be either empty, tagdependent, or scriptless. A
translation error will result if JSP or any other value is used.
Defaults to scriptless.


Note that this is about attributes of a tag (page) directive , not TLD's!


This for Classic Tags:
tagdependent The body of the tag is interpreted by the tag implementation itself,
and is most likely in a different �langage�, e.g embedded SQL statements.
JSP The body of the tag contains nested JSP syntax
empty The body must be empty
This element is optional; the default value is JSP.


This is quoted from the JSP 1.2 DTD. This also probably explains why in the JDiscuss answer E is given: it must have been from an old JSP 1.2 exam.
A few pages above the 1.2 DTD, page 3-17, the same schema is printed as I mentioned in my previous post. Its title is: XML Schema for TLD, JSP 2.0. As I said, there it defines the tag as mandatory.

Yet if I ommit the tag in Tomcat with the 2.0 xsd schema, it gives the following runtime (!) error:
org.apache.jasper.JasperException: /jsp/thread.jsp(8,0) The TLD for the class customtags.ShowPosts specifies an invalid body-content (JSP) for a SimpleTag.
This suggests it still uses the 1.2 schema: tag is optional and defaults to JSP!

I give up now.
[ August 25, 2008: Message edited by: Jan Sterk ]
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm abit confused now as well, cos according to HFS2 pg 508, it say <body-content> tag inside TLD is mandatory, its only optional on tag files.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic