Page 1 of 1

About Question enthuware.jwpv6.2.744 :

Posted: Thu Feb 02, 2012 12:05 pm
by Ciprian Mihalache
I don't understand why we need to specify the <taglib> instructions in web.xml

In other question there is the following explanation:
Make a jar file of all the classes and include *.tld files in META-INF directory inside the jar. You can drop this jar file in WEB-INF/lib of the webapp.
In this case, you need not specify any <taglib> tag in the web.xml. The servlet container will automatically inspect the *.tld file in the jar file and for each <uri> element in the tld, it will add <taglib> tag in web.xml.
This question asks about the required action so that jsp can access the tags in the jar library. Why "None of these" is not a valid answer?
Thank you.

Re: About Question enthuware.jwpv6.2.744 :

Posted: Thu Feb 02, 2012 8:00 pm
by admin
"None of these" is not valid because the question says that the JSP page contains <%@ taglib prefix="test" uri="http://abc.com/graphs/graphlib.jar"> and expects you to tie the uri given in this directive to the tag library that you want to use.

It is not specified that this uri is same as the one present in the tag library descriptor shipped with the tag library (in which case, "None of these" would have been valid.) So you need to map this uri as per the correct option.

HTH,
Paul.

Re: About Question enthuware.jwpv6.2.744 :

Posted: Wed Jul 12, 2017 11:07 am
by RumiJal
Did we assume that there is only one TLD file in the JAR here or did we assume that even if there is multiple TLD files the <uri>http://abc.com/graphs/graphlib.jar</uri> is set correctly in the TLD so the container could know the right file

Re: About Question enthuware.jwpv6.2.744 :

Posted: Wed Jul 12, 2017 10:43 pm
by admin
Not sure I understand your question. You can pretty much map any uri value that is used in a JSP file's taglib directive to any jar. This uri has nothing to do with what is contained in the jar.

HTH,
Paul.