Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does JSP contaner retrieve a tag from tld

 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

prefix="examples"
Hope you meant to say prefix="example"
regds.
- satya
 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/>?
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic