Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Custom tags in Tomcat 3.1 - what's the function of the URI

 
Ranch Hand
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Tomcat, there's 2 places that you'll have to specify a uri.
(1) WEB-INF/tlds/yourfilename.tld
(2) WEB-INF/web.xml
In (1) the file looks like this (abridged for brevity):
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>Time of Day</shortname>
<uri>http://raverun.com/taglib</uri>;
<info>A simple tag library to print time of day</info>
<tag>
<name>tod</name>
<tagclass>TodTag</tagclass>
<info>Prints petang or pagi</info>
</tag>
</taglib>
In (2), it looks like this:
<web-app>
<taglib>
<taglib-uri>
http://raverun.com/taglib
</taglib-uri>
<taglib-location>
/WEB-INF/gavin/gavin.tld
</taglib-location>
</taglib>
</web-app>
My question: Is the <uri> & <taglib-uri> intrepreted for any reasons other than for namespaces purposes?
How are they related ?
Thanks
Photek
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Both uri indicate where your tag definitions will be. You could write your own customerized tag and place a .tld file that somewhat like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>2.2</tlibversion>
<jspversion>1.1</jspversion>
<shortname></shortname>
<info>info>
<tag>
<name></name>
<tagclass></tagclass>
<teiclass></teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name></name>
<required></required>
<rtexprvalue></rtexprvalue>
</attribute>
</tag>
</taglib>
and change that uri point to this file.
Hope this answers your question.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The primary purpose of a URI is unique identification.
For example, here is the start of the taglib for the examples in my book:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<!-- a tag library descriptor for JSPbook Chapter 11 examples -->
<taglib>
<!-- after this the default space is
"http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd"
-->
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>JSPbook</shortname>
<uri>JSPbook/taglib</uri>
<info>
A simple tab library for the JSP and Servlets book examples
</info>
Note that the uri does not give any location.
In the JSP the tag:
<%@ taglib uri="JSPbook/taglib" prefix="ch11" %>
tells the JSP engine to use that taglib where the prefix ch11 appears.
Bill

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic