• 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 version conflict !!! (***doubt)

 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

According specification:
Body Content is mandatory in JSP 2.0.
No defaults like there was in JSP 1.2.

<xsd:element name="body-content"
type="j2ee:body-contentType">
JavaServer Pages 2.0 Specification
<xsd:annotation>
<xsd ocumentation>

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.


</xsd ocumentation>
</xsd:annotation>
</xsd:element>

One doubt here:
I have verified the scenario on Websphere(WAS) 6.1 and Tomcat 5.5.
Both of them are able to default the body-content(if absent in TLD) like this
WAS done like this:
"JSP" for custom tags, "scriptless" for simple tags.

Tomcat done like this:
"JSP" for both custom and simple tags.

So How we should treat this scenario( absence of body-content) in exams.

Take it grated that it works bec'ze container provider's are defaulting based on class mentioned. (or)
Select translation error.




Any questions or suggestions please reply.

[ August 18, 2007: Message edited by: Srinivasan thoyyeti ]
[ August 19, 2007: Message edited by: Srinivasan thoyyeti ]
 
Ranch Hand
Posts: 242
Mac Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Srinivasan

But it's not so with me.
See the tld, which I created today only..



Regards,
Khushhal
[ August 18, 2007: Message edited by: khushhal yadav ]
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
khushhal,

May be we can interpret the specification like this:

There is no single default for body-content of tld for JSP 2.0 tags.

for classic tags default body-content, JSP
for simple tags default body-content, scripless
There are two defaults.
[ August 18, 2007: Message edited by: Srinivasan thoyyeti ]
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not have my HFSJ book handy, but I remember that there was a mock question that was almost identical to your concerns. I too had the same question/concern.

Perhaps it would be wise to follow the way the book handles the correct answer?
 
khushhal yadav
Ranch Hand
Posts: 242
Mac Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Srinivasan

There is no single default for JSP 2.0 tags.

for classic tags, JSP
for simple tags, scripless should be the defaults.
(no single default value as it was in 1.2)



Reality is that there is no default as such for JSP 2.0 tags, neither for simple nor for classic.

Default is only for <body-content> element in tld. And that is JSP.

If you define a simple tag and don't declare <body-content> element for it in tld, you will get a translation error because by default, it's JSP which is not allowed for simple tags. You can even try this.

Yes, there is default for tag files and that is scriptless.

Regards,
Khushhal
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi khushhal,

You are deviating ...I am talking about boduy-content alone.

Khushhal posted: Reality is that there is no default as such for JSP 2.0 tags, neither for simple nor for classic.

Default is only for <body-content> element in tld. And that is JSP.



and I am able run to both custom tag, simple tag programs with out body-content
[ August 18, 2007: Message edited by: Srinivasan thoyyeti ]
 
khushhal yadav
Ranch Hand
Posts: 242
Mac Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Srinivasan,

But in my case, I am not able to run simple tag without <body-content> element declared in tld.

I always get translation error, whenever I try to do this.

Regards,
Khushhal
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Latest update to this:

On Websphere Application server I am able to run both custom tags and simple tags without having the body-content tag in TLD.

but

in Tomcat web server, I am able to run with custom tag, but not with simple tags.

Thats the scenario now.
So what decision we can take.
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael Ku,

Did you tested that scenario in WAS ?

Originally posted by Michael Ku:
Perhaps it would be wise to follow the way the book handles the correct answer?



Whats the book says.

But I have encountered a mock question in Wizlabs ,

In that they havn't given body-content tag in TLD for simple tag.
and in JSP simple tag's body they have accessed a scriplet.

They expected the answer as "scriptlet accessed in the body of simple tag"

So any comments
[ August 18, 2007: Message edited by: Srinivasan thoyyeti ]
 
khushhal yadav
Ranch Hand
Posts: 242
Mac Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Srinivasan,

You may be right.
Thanks for pointing it out.

Regards,
Khushhal
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I lent the book to someone for the weekend. When I get it back I will locate the question.
 
khushhal yadav
Ranch Hand
Posts: 242
Mac Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Consider this, it will make everything clear.



Once again thanks Srinivasan .
Otherwise, I would have been kept myself stuck with that only.

Regards,
Khushhal

[ UD: added line breaks for better readability ]
[ August 19, 2007: Message edited by: Ulf Dittmer ]
 
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

So How we should treat this scenario( absence of body-content) in exams.


There is no default value for the body-content, that's all you need to remember. If you remember what's in this faq, then you should be ok
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

Point 1.
Christophe, yet things are not clear. please look into exam point of view. its complex.

Christophe Verre posted:
There is no default value for the body-content, that's all you need to remember. If you remember what's in this faq, then you should be ok.



According to specification body-content must be specified(MANDATORY) in the TLD in JSP 2.0. (and there are no defaults)

Shall we select compilation(translation) error if body-content is missing from the TLD.
------------------------------------------------------------------
Point 2:
Why I am able to run both custom, simple tag handlers with out having <body-content> declaration in TLDs on WAS 6.1.

in WAS its able to defalut <body-content> (if absent in TLD) for both cutom,simple tag tlds as "JSP" and "scriptless" respectly.

------------------------------------------------------------------------
Point 3:

Tomcat is still initializing in the old way( see JSP 1.2 for TLD).
Irrespective of tag used if <body-content> absent its defaulting to JSP.

I am here to confirm that TOMCAT 5.5 is not following <body-content> requirements of JSP 2.0.

3.1 Here is my tld:



3.2 Here is the error it has thrown:

The TLD for the class edu.jsp.simpleTag.ListMovies specifies an invalid body-content (JSP) for a SimpleTag.



Please understand what kind of puzzle we are in.
Please give me a convincing answer.

[ August 19, 2007: Message edited by: Srinivasan thoyyeti ]
 
Christophe Verré
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

Please give me a convincing answer.


Sorry Srinivasan, I was only answering in the scope of the exam

I've seen other threads already discussing this, and you'd probably find them too if you search for it. Some container providers may have decided to set a default value for the body tag content, but as far as the spec is concerned, there is no default value, so you should set one. If you assume that Tomcat is setting it to JSP, and you're ok with, then you may run into trouble if you decide to port your application to another container.

If you get out of scope of the exam at this stage, you'll find it difficult to remember which was right from wrong when you pass the exam. That's why I only wanted to tell to remember what the fact is.

Shall we select compilation(translation) error if body-content is missing from the TLD.


If there were such a question at the exam, it would be straight forward. It will not leave you wondering if it's a translation error or not.

Why I am able to run both custom, simple tag handlers with out having <body-content> declaration in TLDs on WAS 6.1.


Refer to WAS documentation, or contact their support center. They may have decided to set a default value.

Please understand what kind of puzzle we are in.


I'm answering your first question : "So How we should treat this scenario( absence of body-content) in exams." Answer is : there is no default.

Remember that those containers are not considered to be reference implementations. You have to remember what is in the faq, not what WAS or Tomcat do. If you want to understand what Tomcat does, your thread would be more appropriate in the Tomcat forum
 
khushhal yadav
Ranch Hand
Posts: 242
Mac Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Christophe

For clarifying it.I will keep it in mind.

Default is only for <body-content> element in tld. And that is JSP.



Actually, I have read that somewhere, that's why that was there in my mind.

Regards,
Khushhal
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Christophe Verre,

Thanks.

I prey this question never comes in my exam.

If it comes in exam then I will see it in the end only.

Khushhal, After reading Christophe Verre's post still you are saying there is default for <body-content> in TLD.


Thanks everybody.
[ August 20, 2007: Message edited by: Srinivasan thoyyeti ]
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the schema the tag body-content is mandatory.

So a tag "tag" without the tag "body content" should fail in the schema validation itself, it would have been wise if the message is given by the vendors instead of assuming some default value. It would have avoided all the confusion.
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with you Amol.
Your posts are also good.
 
khushhal yadav
Ranch Hand
Posts: 242
Mac Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Srinivasan

You got my post in a wrong way.
Actually I meant to say I had got what Christophe had conveyed.

The thing I quoted was in my mind earlier.


Regards,
Khushhal
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Khushhal,

Then its ok.

it looked to me like that.


 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic