• 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

default value of body-content

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For tag files its.. Scriptless... but for custom tags.. its mandatory...
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For classic tag's, the default value is "JSP".
 
savita jadhav
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks all of you and especially you phil.I didi got your point.

Savita
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Phil Kurian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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

Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic