About Question enthuware.jwpv6.2.744 :

Moderator: admin

Post Reply
Ciprian Mihalache
Posts: 51
Joined: Wed Sep 28, 2011 12:14 pm
Contact:

About Question enthuware.jwpv6.2.744 :

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

admin
Site Admin
Posts: 10034
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.744 :

Post 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.
If you like our products and services, please help us by posting your review here.

RumiJal
Posts: 9
Joined: Wed Jul 12, 2017 10:51 am
Contact:

Re: About Question enthuware.jwpv6.2.744 :

Post 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

admin
Site Admin
Posts: 10034
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.744 :

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests