aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes default value of body-content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "default value of body-content" Watch "default value of body-content" New topic
Author

default value of body-content

savita jadhav
Ranch Hand

Joined: Mar 05, 2001
Posts: 62
Hi
I am fully confused about the <body-content>.
what is the default value of <body-content> of <tag> element ?
Is it JSP or scriptless.For custom tag implementing is the default value different?

please help

Savita
Reshma Shanbhag
Ranch Hand

Joined: Sep 17, 2002
Posts: 203
with JSP 2.0 <body-content> does not have a default value and is a mandatory element.

With simple tags the options you could have is 1.) scriptless 2.) tagdependent 3.) empty

with classic tag's the options would be 1.) scriptless 2.) tagdependent 3.) empty 4.) JSP


Hope that helps
Reshma


SCJP 1.4, SCWCD 1.4
Roy Simon
Ranch Hand

Joined: Aug 26, 2005
Posts: 62
For tag files its.. Scriptless... but for custom tags.. its mandatory...
Phil Kurian
Ranch Hand

Joined: Feb 26, 2006
Posts: 35
Sorry I have to disagree with these answers.

According to the Specification <body-content> is NOT mandatory and it does default to JSP.

The xml definition is as follows

<!ELEMENT tag
(name, tag-class, tei-class?,
body-content?, display-name?, small-icon?, large-icon?,
description?, variable*, attribute*, example?) >

Which indicates that body-content can occur 0 or 1 times (i.e. the (?)).

If body-content is left out then it will default to JSP.

Note that it is pseudo-mandatory for simple tags. This is because simpletags cannot have scripts in the body content, so JSP is not a valid option. Hence if using tag files, the deployer must not rely on the default value of JSP. The deployer must specify a value for <body-content> namely "tagdependent" or scriptless.

On examining the specification docs, it appears there isn't even a defined term for "scriptless". It appears to be just a convention used for overriding JSP.
[ July 02, 2006: Message edited by: Phil Kurian ]

SCJP (1.4)
Yi Yuan
Greenhorn

Joined: Jul 03, 2006
Posts: 22
For classic tag's, the default value is "JSP".


SCJP 1.4 - 95% Passed<br />SCWCD 1.4 - 89% Passed
savita jadhav
Ranch Hand

Joined: Mar 05, 2001
Posts: 62
Hello all,
So in short
1.The <body-content> is not mandatory
2. Its default value is JSP
3.But for simple tag its scriptless

Am I right?
Thanks alot all of you
Savita
Phil Kurian
Ranch Hand

Joined: Feb 26, 2006
Posts: 35
For classic tag's, the default value is "JSP".



Whilst true, this is NOT limited to classic tags.

It will default to JSP for simple tags also. which causes an error!

Look at the results I have below:

With the following TLD


I get the following error

org.apache.jasper.JasperException: /simpletag.jsp(9,8) The TLD for the class pk.CharConvSimpleTag specifies an invalid body-content (JSP) for a SimpleTag.

It's quite clear That if you are using simple tags you MUST specify a body-content which is something other that JSP, as the tld will automatically default to JSP if not specified (which causes an error)
Phil Kurian
Ranch Hand

Joined: Feb 26, 2006
Posts: 35
Hello all,
So in short
1.The <body-content> is not mandatory
2. Its default value is JSP
3.But for simple tag its scriptless


1 and 2 are correct.

Simple tags will default to JSP also. But will cause an error, so you'll need to explicitly define it to something else.

Remember the TLD is an xml document. So the rules which apply for the custom tags will also be applied to the simple tags (i.e. same xml doc from the containers point of view).

[ July 03, 2006: Message edited by: Phil Kurian ]
[ July 03, 2006: Message edited by: Phil Kurian ]
savita jadhav
Ranch Hand

Joined: Mar 05, 2001
Posts: 62
Thanks all of you and especially you phil.I didi got your point.

Savita
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi Phil and Savita,

I think Phil is refrering the old version of the TLD specification. As per the JSP 2.0, there is no jspversion element in the tld. For the JSP 2.0, there is no XML DD document, the scema is definded using XSD. The <body-content> is mandatary as per JSP 2.0 for <tag>.

Thanks


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Phil Kurian
Ranch Hand

Joined: Feb 26, 2006
Posts: 35
I think Phil is refrering the old version of the TLD specification. As per the JSP 2.0, there is no jspversion element in the tld. For the JSP 2.0, there is no XML DD document, the scema is definded using XSD. The <body-content> is mandatary as per JSP 2.0 for <tag>.


Now I'm getting confused.

The JSP spec I've been looking at is the JSP 2.0 spec on JCP. According to that spec jsp-version (note the hyphen) is mandatory and body-content is not.

Seems to be the same in SCWCD exam study kit (deshmukh et al).

Unless both of them are wrong (which is quite possible) it seems body-content is not mandatory unless using simple tags.
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

The JSP spec I've been looking at is the JSP 2.0 spec on JCP. According to that spec jsp-version (note the hyphen) is mandatory and body-content is not.


Yes it is <jsp-version>. The hypen is there. But it is for the tld for JSP 1.2.
I Also have Deshmukh's book. It is reffering the tld for 1.2 enven in latest book.

The <jsp-version> is not in the tld defination for JSP 2.0.

If you look at the final specification of the JSP 2.0 ( the pdf document is jsp-2_0-fr-spec.pdf) on page 400 ( Section III page 16) there is schema diagram, which show that there is no <jsp-version> element in taglib defination. Instead the taglib defination have mandatary alttribute called version. The only mandatary element in tld definations are

<short-name>
<tlib-version>

Thanks
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

In continuation. On page 404 ( Section III, Page 16) , the diagram shows that the sub-elements mandatary for the <tag> elements are

<name>
<tag-class>
<body-content>

Thanks
savita jadhav
Ranch Hand

Joined: Mar 05, 2001
Posts: 62
Hi Narendra
Thanks for clearing the doubt but still I am little confused. I was looking the spec which I got through links of scwcd . But it doesn't have 400 pages it has only 374 pages.so can u please tell how to get the spec of which u r reffering i.e jsp-2_0-fr-spec.pdf.

thanks
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

I had downloaded it one year back. The latest link for this spec is here

Thanks
 
wood burning stoves
 
subject: default value of body-content