• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding the URI element for Taglib

 
sravanthi pulukuri
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Iam very cofused with URL elemnt they use in Taglibe directive.

Is that the same one which we mention in web.xml or the one in TLD file??
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sravanthi pulukuri wrote: hi,

Iam very cofused with URL elemnt they use in Taglibe directive.

Is that the same one which we mention in web.xml or the one in TLD file??



Please refer HFSJ and read the related chapters, you will get through with your doubts

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that the same one which we mention in web.xml or the one in TLD file??

First, you don't need to declare tag libraries in web.xml, so you can forget about that

Think of URIs as being unique identifiers, to help the container locate them. The containers keeps a mapping of URIs to Tag Library, so when you use a URI in a tag directive, the container will use this mapping to locate the the library.
 
sravanthi pulukuri
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

but then why is

<tag-lib>
<taglib-uri>
<taglib-location>

used in web.xml??

please help.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but then why is

<tag-lib>
<taglib-uri>
<taglib-location>

used in web.xml??

It was used until Servlets 2.3. From Servlets 2.4, the container will look for mappings himself, so there's no need to use these tags anymore.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was used until Servlets 2.3. From Servlets 2.4, the container will look for mappings himself, so there's no need to use these tags anymore.


yes Christophe is right. from servlet 2.4 the container autometically build the map between TLD and <uri> names. so when the jsp invokes a tag, container knows exactly where to find the TLD that describe the tag, by looking through a specific set of locations ehere TLDs are allowed to place in a web application.

But if you do specify an explicit <taglib-location> element in the web.xml , JSP 2.0 container will use it to create <uri>-to-TLD map.

So the container first look in the DD to check such mappings and after it choose to build automatic mappings. more important thing you do remember that theses tag are used only under <jsp-config> element.

like
 
sravanthi pulukuri
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

that clears me.
Suppose if i dont specify explicity any mapping in web.xml so the URL element in TLD should be same as the one in Jsp invocation is it?

if it has a web.xml mapping how which URI should i map in jsp??
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sravanthi pulukuri wrote:hi,

that clears me.
Suppose if i dont specify explicity any mapping in web.xml so the URL element in TLD should be same as the one in Jsp invocation is it?

if it has a web.xml mapping how which URI should i map in jsp??


I gave you an example in my last post. again this is the way to configure it

<jsp-config>
<taglib>
<taglib-uri>Someuri</taglib-uri> here you need to declared your URI or a name through which you can access this library in the JSP file
<taglib-location>/WEB_INF/someLocation</taglib-location>
here you have to declare the location reletive to the context path and its always starting with /WEB_INF
</taglib>
</jsp-config>


I hope this will help. Please refer HFSJ for further details
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic