Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

body-content: tagdependent

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

"Since the body-content is tagdependent, it must implement the BodyTag interface."

Is this statement correct?

I tested the following:


simple tag class


tag descriptor:
[/code]
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
<tlib-version>1.0</tlib-version>
<short-name>tiger</short-name>
<uri>/WEB-INF/tlds/tiger</uri>

<tag>
<name>cheeta</name>
<tag-class>com.examples.web.TigerTag</tag-class>
<body-content>tagdependent</body-content>
</tag>
</taglib>
[/code]

Output comes:

<%= 3*3%>


Thanks,
[ August 15, 2007: Message edited by: Chandra Bhatt ]
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandra

I don't know what's your doubt.

But the output you are getting
<%= 3*3%>
is perfectly correct and expected output.

And about the statement
"Since the body-content is tagdependent, it must implement the BodyTag interface."

is absolutely incorrect and abosulity illogical.
Yes it can be may, but it can't be must.


By the way, from where did this idea come to your mind?
Please drop it right now.

Regards,
Khushhal
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi khushhal,

This was from the jdiscuss mock exam, and this option was said correct
that is why it was crawling in my mind so asked.

Now doubt is cleared.

Thanks for help!

Please confirm the valid <body-content> for simple and classic tags.

1- scriptless is default in the simple tag.
others may be tagdependent, empty.

2- JSP is default for classic tag handler (Not sure)
other may be tagdependent, scriptless and empty

Thanks again!
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandra,

NOTE

As such there is no default for simple tag or custom tag.
There is only default for <body-content> and that is JSP.
As in your TLD, you can't specify whether it's simple or custom tag.
That is something the JSP engine comes to know only after seeing the implimentation of your class


You do one thing.
You create a Simple tag.
And don't declare <body-content> in TLD for that tag.

You will see you will get a translation error.
Saying something JSP is not valid option for <body-content> for simple tag.

Regards,
Khushhal
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got:

1- JSP is default setting (as it can't be guess from the TLD whether it
is simple tag or classic tag)
2- We must set <body-content> for the simple tag, as JSP is not valid
for the simple tag (i tried as you said)
3- scriptless, tagdependent and empty are others for both (simple and classic)

Now is that correct?


One more thing:

"As in your TLD, you can't specify whether it's simple or custom
tag."


If we see <body-content>JSP</body-content> in the TLD, we can say it is for
classic tag handler. Right?

Thanks,
[ August 15, 2007: Message edited by: Chandra Bhatt ]
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

One more thing:

"As in your TLD, you can't specify whether it's simple or custom
tag."

If we see <body-content>JSP</body-content> in the TLD, we can say it is for
classic tag handler. Right?



Yes, you can say.

But if it's not, then I think now you know what will happen.

A big TRANSLATION ERROR

Regards,
Khushhal
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

Translation errors hurt me too!
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

Whatever has been discussed in this thread that holds good for JSP 1.2

There has been some change in JSP 2.0 which is there in this Thread

Thank Srinivasan. Please refer this thread body-content version conflict !!!

Regards,
Khushhal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic