• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

taglib problem

 
luis meira
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone,
i wonder if u could help on this one :
consider the a jar named mytags.jar with folloing structure :
mytags\MyTag.class
META-INF\taglib.tld
i put the jar on lib directory of the web application.
1)
<%@taglib prefix="x" uri="/web-inf/lib/mytags.jar" %>
i get a translation exception on this one and i don't have any why ?
2) i've made some changes to the web.xml file
<taglib>
<taglib-uri>/buga</taglib-uri>
<taglib-location>/web-inf/lib/mytags.jar</taglib-location>
</taglib>
i also get a translation exception on this one also.
i don't understand why also.
yet if i change :
<taglib-location>lib/mytags.jar</taglib-location>
it works perfectly. i don't understand this.
can anybody explain me the reason of this exceptions ?
best regards
luis meira
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,In your jsp file after changes 2, try putting
<%@taglib prefix="x" uri="/buga" %>
 
luis meira
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well i forgot to mention that one.
but i also made that change.
my dougt was why i get an exception 1) and why get an exception 2.1) and works perfectly 2.2)
any ideas ?
luis meira
Originally posted by Vedhas Pitkar:
Hi,In your jsp file after changes 2, try putting
<%@taglib prefix="x" uri="/buga" %>
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
taglib-location can take both a root-relative (starts with a /) or a non-root relative, like in your example 2.2.
If it starts with a /, it looks for a path starting in your root context. Since you are using /web-inf/... (and not /WEB-INF/..., notice the case-sensitivitiy here), the container is trying to find that path, but isn't able to since you don't have a web-inf folder (again, case-sensitive here!).
In cases where the taglib-location doesn't start with a /, the engine adds /WEB-INF/ to the location, so you end up /WEB-INF/lib/mytags.jar, which actually does exist.
If you changed your first example, or 2.1, to have /WEB-INF instead of /web-inf, it will most likely work.
[ November 20, 2002: Message edited by: jason adam ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic