• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

implicit mapping - taglib ???

 
Rick Rangers
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Right now I'm studying for the exam and I've reached the topic:

associating URIs with TLD file locations: implicit mapping

I'm a bit confused on this one. What exactly is implicit mapping?
If you put the taglib.tld in a jar file and store this jar-file in the lib directory of your webapplication. Is that enough for the JSP engine to do a implicit mapping? Suppose the taglib.tld has an <uri> element like this : "http://www.someserver.com/abc" and the JSP page contains:

<%@ taglib prefix="test" uri="http://www.someserver.com/abc" %>
can the container based on this info make a implicit mapping? Do i need
to do also something with the web.xml in this case?

Another thing, suppose the web.xml contains:

<taglib-uri>http://www.someotherserver.com/xyz</taglib-uri>
<taglib-location>myLib/test.jar</taglib-location>

Is this a case of implicit or explicit mapping?

As you can see I'm very confused on this subject so any help
would be appreciated, thanks!

Regards,
Rick
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"implicit mapping" simply means that you don't have to care about mapping a library to a uri.
If you put the library where the container can find it, that the container will do the mapping for you.
As you said, if you put the jar file (with a TLD in META-INF or subdirectory of it) in the lib directory,
the container will do the mapping. You won't have to touch web.xml.
Anything you put in web.xml is called "explicit".

All you'll have to do is to use the taglib directive in your jsp, using the uri provided in the tld which is inside the jar file.

Tlds don't have to be necessarily inside jar files. They could also be in the WEB-INF directory, or some subdirectory of it.

Refer to the spec, "JSP.7.3.1 Identifying Tag Library Descriptors", which gives clear explanation about it.
 
Rick Rangers
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply! I understand it now, thanks!

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