• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

body-content default?

 
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 again

Does somebody know what is the default
if no <body-content> element is defined
in a TLD?

Thanks
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the default is JSP
 
Ernesto Leyva
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes that's what I thought but in a mock exam
I got is vendor dependant because this option
is invalid for SimpleTags???
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<!--
The body-content element provides provides information on the content of the
body of this tag. This element is primarily intended for use by page composition
tools.
There are currently three values specified:
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
#PCDATA ::= tagdependent | JSP | empty
-->
<!ELEMENT body-content (#PCDATA) >



Look at the DTD yourself...
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I look at it myself And there is no mention of JSP as being the default value. Are you looking at 1.2 ? The exam is about 2.0.

The spec says :

the <body-content> of a SimpleTag cannot be �JSP�. A TLD is invalid if it specifies �JSP� as the value for <body-content> for a tag whose handler implements the SimpleTag interface. JSP containers are recommended to but not required to produce an error if �JSP� is specified in this case.


And in the DTD 2.0:
<body-content>
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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<body-content> of Simple Tag cannot be "JSP". Default to "scriptless" for Tag.
 
Kiran Bhangale
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<body-content> of Simple Tag cannot be "JSP". Default to "scriptless" for Tag.
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh shuckssssss

where did u get the DTD for 2.0? its not available on the java.sun.com, neither is the DTD for web-app_2_4 miserable people
 
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,

There is no DTD for the Servlet 2.4 and JSP 2.0. Instead the specification provide the XML Schema Document in the specification PDFs.

As per the JSP 2.0, though it is mentioned that the scriptless is reasonable default for the Simple Tag, it made the <body-content> element mandatary. So there is no default for Simple Tag and Custom tag in the JSP 2.0. For the tag files the default value is scriptless.

This problem is discussed earlier posts. One of the latest is here


Hope this help.

Thanks
[ April 27, 2006: Message edited by: Narendra Dhande ]
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure Narendra, I think that <body-content> element is mandatory only for Simple Tags, not Custom Tags, and if we don't specify <body-content> in the tld for a Custom Tag, the default will be JSP. I tested it on my Tomcat, I omited the <body-content> element and put scriptlet inside the body of the tag, everything worked fine. You have access to Sun Java Application Server, please check it out.
 
Ernesto Leyva
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes

I ran the same test in Tomcat5.5. I created a simple tag
then I didn't put the <body-content> in the TLD then
I got an error in my web browser saying the value for
body-content JSP was invalid. So seems tomcat is doing
JSP the default but I belive this is tomcat specific only.

For tag-files you use the TAG directive and yes the default for
it should be "scriptless" this is inconsistence with the other
two tags simple and classic
 
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,

When define the tld for custom tag or simple tag, there is no indication that the <tag> entry is for the simple tag or custom tag. I observe the tomcat behavior that it does not validate the web.xml at the time of deplyment, so if there is any error in the Deplyment descriptor it display at the run-time.

I tested it on the Sun application Server. It is not giving any error at the deploy time but giving error at run-time like tomcat. I define a tag without <body-content>. It allow me to deploy the application, but when invoke the JSP file which is using this tag give the following error.




This shows that the default body content is still JSP for all types of tag. But this is compile-time error.


Thanks
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats because both tomcat and ur sun appl server use the 2.3 dtd.
tomcat users- check out the dtd declared in the xml files
and app server users check out the dtd's in the "schema" folder.
you'll only find xsd's for 2.4 but not the dtd

but don't know about the new dtd...if it really doesn't have a default. but as someone said, its there in the spec.
 
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 mentioned in the previous post that there is no DTDs for these versions
because there are some limitations with DTDs to define XML Schemas. Therefore in these versions the XML definations are in the XSDs instead of DTDs.

Both tomcat 5.5.x and the Java application server use the correct xsds. This is the entries in the web.xml.



The default value of the <body-content> as you mentioned is not directly related to the XML Schema documents of Servlet 2.4 and JSP 2.0. It is related to the TLDs DTD or XSDs. I think the web container supporting 2.4 xsd, have a proper xsd for TLD defination using JSP 2.0.

The entries in my TLD file are :



I think it is problem of how the container parse and interpreate the Schema document.

Thanks

[ April 29, 2006: Message edited by: Narendra Dhande ]
[ April 29, 2006: Message edited by: Narendra Dhande ]
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic