This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes How does JSP contaner retrieve a tag from tld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How does JSP contaner retrieve a tag from tld" Watch "How does JSP contaner retrieve a tag from tld" New topic
Author

How does JSP contaner retrieve a tag from tld

Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
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

Joined: Jun 03, 2000
Posts: 5040

prefix="examples"
Hope you meant to say prefix="example"
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
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

Joined: Jun 03, 2000
Posts: 5040

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

Joined: Apr 06, 2001
Posts: 371
Thank you so much.
 
 
subject: How does JSP contaner retrieve a tag from tld