Hi, I am confused about how does JSP Container retrieve a tag from a tld. The prefix attribute specifies which tag library will be invoked by the taglib uri, right? For <%@ taglib uri="/hello" prefix="examples">, <example:hello> will invoke a tag whose name is "hello" in the tag library "example" (at /hello)? Thank you so very much.
Thank you Satya! Yes, prefix="example". Is that how the JSP container find the right tag from the tag library "example", by <name/> element in the <tag/> in <taglib/>?
Joined: Jun 03, 2000
Yes. The way I understand this is as follows: (Hopefully someone will correct me if I mis-state something) Using the prefix example, it locates the TLD file ( mind you, the URI can also be a jar file, I tested it ). In the TLD file, it expects to find the tagName (the part after the prefix specified in the JSP, without the colon) under the Name (as you mentioned) element of a tag element. It it finds a matching tag/name it uses all that tag classes and attributes. While I have't tried, I am relatively confident that you can use more than one tag libraries (TLD's) in a JSP each of which has a unique prefix. Hope this helps. regds. - satya