This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Am I correct about body-content ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Am I correct about body-content ???" Watch "Am I correct about body-content ???" New topic
Author

Am I correct about body-content ???

Giju George
Ranch Hand

Joined: Jun 08, 2004
Posts: 333
For tag files:-
<body-content>tagdependent|empty|scriptless<body-content>

Default:- scriptless

For Simple Tags:-
<body-content>tagdependent|empty|scriptless<body-content>

Default:- scriptless

For Custome tags:-
<body-content>JSP|tagdependent|empty|scriptless<body-content>

Default:- JSP


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCEA
vanam kris
Greenhorn

Joined: Nov 19, 2004
Posts: 12
Yes that's correct
Gabriel Forro
Ranch Hand

Joined: Apr 16, 2004
Posts: 59
Hello,

I think, You are not correct regarding simple and classic custom tags.

In the JSP 2.0 spec the <body-content> element is mandatory in the tld file for the simple ang classic custom tags. So there is no default value.


Gabriel
taty gora
Greenhorn

Joined: Nov 29, 2004
Posts: 16
Hi ,
I think,

For Simple Tags and Classic Tags default is
<body-content>tagdependent</body-content>
taty gora
Greenhorn

Joined: Nov 29, 2004
Posts: 16
Actually,
I didn't find default for the <body-content> in JSP 2.0 specs.
It should depend on implementation.

T
Krzysiek Hycnar
Ranch Hand

Joined: Jan 02, 2004
Posts: 74
And the winner is.. Giju George

You're right!! This is a kind of subtelty worth to remember.
You don't have to specify the <body-content> for Classic Tags, however you must specify <body-content> for Simple Tags and it cannot be JSP (the default value is JSP, if you don't type it explicite you get the default value). I wrote about it replying go Jean's post (can be found here)

So Gabriel, either you're wrong or Tomcat 5.x does not fully support JSP 2.0. Just think, how stupid would be of the specs creators be to make the <body-content> mandatory in JSP 2.0. There are plenty of web apps that sonner or later will be ported to containers that support JSP 2.0, and all of the tlds in all of them would have to be changed to explicitly state what content the tags deal with (in pre 2.0 spec the <body-content> was NOT mandatory)

Cheers
Chris
Gabriel Forro
Ranch Hand

Joined: Apr 16, 2004
Posts: 59
Hi,

Tomcat is a very friendly container. The XML validation is switched off by default. If You check the
http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd
xml schema, You can notice, that the body-content is not an optional element.
In my opinion if You use <taglib ... version="2.0">, than there is no default value for the classic and simple tags, as the tld file is invalid without a <body-content> element.

The body-content element's definition from the
http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd
schema:



If You use older version of tld (validated by
http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd
), where You can use only classic tags, then the default value is JSP. This is the case for older tag libaries.

For the 1.4 exam You have to know the JSP 2.0 spec.
[ December 15, 2004: Message edited by: Gabriel Forro ]
 
 
subject: Am I correct about body-content ???
 
Similar Threads
Default values for body-content element
Need clarification on Ch. 10 mock question 17.
body-content for tag files, classic and simple tags
allowable body-content values
body-content in tags