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.
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.
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.
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.
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..
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