Forums Register Login

Hi Marcus..

+Pie Number of slices to send: Send
Hi Marcus..

Today only I took your Summary Quizes. They were good.
But I faced some ambiguity in them.
I may be wrong but please clarify them.
Should I post them in the forum or send you a mail.

Regards,
Khushhal
+Pie Number of slices to send: Send
In the forum is good, that way plenty of other people can see and/or comment. Thanks for the feedback.

Marcus
+Pie Number of slices to send: Send
Hi Marcus

Thank you for your reply.
I think, it would be better if we will one question at a time.
And please keep this discussion alive.


Summary Quiz 3
62
Marks: 1/1
Which of the following statements are true?
The
Choose at least one answer.

a. The value of the tagdir attribute of a taglib directive may point directly at the tld file
b. The value of the tagdir attribute of a taglib directive must point directly at the tld file
c. The taglib directive can use either the tagdir or the uri attribute to locate the tld file
d. the prefix to a custom tag must be a single letter

Correct
Marks for this submission: 1/1.



Here you are using tagdir attributes, but refering them to tld file. Shouldn't it be tag files.
Because tagdir is concerned with tag files only.
Although even in the case of tag files, we have tlds, but they are container maintained implicit tlds and we are not concerned with them.
Moreover tag files are equivalent to SimpleTag handlers not tlds. So how come the above statements can be for tld files.

And see this line carefully

The value of the tagdir attribute of a taglib directive may point directly at the tld file



The tagdir attribute doesn't point directly to the file. But it points to the location of the file, I mean to say the containing folder.

Regards,
Khushhal
+Pie Number of slices to send: Send
This is a flawed question, I'll work on changing it so it makes sense and I'll post the result here.
+Pie Number of slices to send: Send
Marcus,

Second doubt that came to my mind regarding the same topic was when I was doing your Summary Quiz 1. I can't recall the question completely nor I did save that quiz.
In one of the question, you asked what should be loaction of tlds. Among the options, two were.
1. /WEB-INF or any of its sub directories ( absolutely correct option)
2. Anywhere in your application including context root.

I say why not second one too. What about when "fallback mechanism" is used.
It searches the tld as per its location. And can locate your tld even if present in your context root depending upon path provided.

Regards,
Khushhal
[ August 23, 2007: Message edited by: khushhal yadav ]
+Pie Number of slices to send: Send
Can you elaborate on what the "fallback mechanism" is ? TLDs are searched under WEB-INF, or under META-INF in a jar file.
+Pie Number of slices to send: Send
Hi Christophe

But I don't think it's imperative to have your TLDs under under WEB-INF only.

And "fallback mechanism" is that when instead of specifying the uri of TLDs, we specify the location of our tlds directly in the uri attribute of taglib directive.

The only limitation in this case is that we can't have absolute path for our tlds as that will give us an error.
But we can have both nonroot relative and root relative path of our tlds.

But we rarely use this approach, because pointing to a TLD directly takes away the flexibility of our application.

Suppose my TLD "mytld.tld" is in my context root directly.

Then in taglib directive, I can write

<%@ taglib uri="/mytld.tld" prefix="x"%>



It works and it's feasible. But takes away the flexibility of our application as if we change the location of our TLDs. We have to change it in each and every view, we have developed that means a horrible maintenance nightmare.

Regards,
Khushhal
+Pie Number of slices to send: Send
khushhal, have you got an example working where a tld has been located in the root directory?
+Pie Number of slices to send: Send
Yes Marcus..

Regards,
Khushhal
+Pie Number of slices to send: Send
And that is also a very very simple one..
which I created just now..
And sorry I am out at work, so don't have all the stuff avilable with me.
Some how managed with all that I have..

Click here to see where did I place it Location of myTags.tld
Click here to see the snapshot console_display
Click here to see output in browser browser_display

I am posting code for all that..

It's my TLD mytags.tld which I placed in my context root.


---------------------------------------------------------------------------
And here is the code for my JSP conditionalTag.jsp


---------------------------------------------------------------------------

Here is what I am getting in my tomcat console

Request org.apache.coyote.tomcat5.CoyoteRequestFacade@45e228 destroyed at Fri Aug 24 22:52:49 IST 2007
Request org.apache.coyote.tomcat5.CoyoteRequestFacade@45e228 initialized at FriAug 24 22:52:53 IST 2007
I am in release
conditionalTag.jsp is created
conditionalTag.jsp is initialised
Request org.apache.coyote.tomcat5.CoyoteRequestFacade@45e228 destroyed at Fri Aug 24 22:52:53 IST 2007



---------------------------------------------------------------------------


Hope, I am successful in conveying what I want to convey..

Code for my tag handler class MyConditionalTag.java



Regards,
Khushhal

[ August 24, 2007: Message edited by: khushhal yadav ]
[ August 24, 2007: Message edited by: khushhal yadav ]
+Pie Number of slices to send: Send
khushhal, thanks for posting all the code. It amde it easy to follow the discussion
Good night. Drive safely. Here's a tiny ad for the road:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1151 times.
Similar Threads
Marcus Green's Quiz #3 Scored 81 ...
body-content version conflict !!! (***doubt)
Cleared SCWCD with 94%
Cleared SCWCD
PASSED SCWCD WITH 73%
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:30:30.