You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by maya <ma...@yahoo.com> on 2006/09/10 19:18:19 UTC

uri question..

hi,

I have been studying taglibs and beans for days now, and am still 
confused about some things, but for now a simple question (I hope..) re uri:

let's take JSTL.. the jstl.jar for my app is here..

    /WEB-INF/lib

yet the uri for it in taglib directive in JSP (and in <uri> tag in tld) is

      http://java.sun.com/jsp/jstl/core

how does the container find the classes in /WEB-INF/lib/jstl.jar when 
the uri points to an outside url? (and the classes are not at this url 
either..;)

hope this question makes sense..  in oreilly (JSP, 3rd ed, ch7) it says 
the 'uri' attr in taglib directive in JSP is there to find "the class or 
tag file for each custom action."
Then in the very next sentence it says, "the attribute contains a string 
the container uses to locate the TLD for the library.." but it points to 
a uri for the classes, right? (or tag files..) not the tld..

(and come to think of it, why is this necessary at all, since the <tag> 
element in the tld always has a reference to the class (like the web.xml 
for servlets always contains a ref to the servlet class..) and if using 
tag files like this:

     <tag-file>
       ...
       <path>/WEB-INF/tags/mytags/copyright.tag</path>
    </tag-file>

so, what exactly is the point of the uri and what DOES it point to 
really?  thank you..

-m













---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: uri question..

Posted by maya <ma...@yahoo.com>.
Eric Haszlakiewicz wrote:
> On Sun, Sep 10, 2006 at 01:18:19PM -0400, maya wrote:
>> I have been studying taglibs and beans for days now, and am still 
>> confused about some things, but for now a simple question (I hope..) re uri:
>>
>> let's take JSTL.. the jstl.jar for my app is here..
>>
>>    /WEB-INF/lib
>>
>> yet the uri for it in taglib directive in JSP (and in <uri> tag in tld) is
>>
>>      http://java.sun.com/jsp/jstl/core
>>
>> how does the container find the classes in /WEB-INF/lib/jstl.jar when 
>> the uri points to an outside url? (and the classes are not at this url 
>> either..;)
> 
> 	The tld files in your WEB-INF directory also have a uri.  The
> container matches up the uri from your jsp file with one of the uri's
> in the tlds.
> 
> eric

this gets more confusing..  here at work I see this:

   uri="struts-tiles.tld"

I thought the uri was to point out where CLASSES (or tag files) are, not 
tld's...

thanks...






---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: uri question..

Posted by Eric Haszlakiewicz <er...@swapsimple.com>.
On Sun, Sep 10, 2006 at 01:18:19PM -0400, maya wrote:
> I have been studying taglibs and beans for days now, and am still 
> confused about some things, but for now a simple question (I hope..) re uri:
> 
> let's take JSTL.. the jstl.jar for my app is here..
> 
>    /WEB-INF/lib
> 
> yet the uri for it in taglib directive in JSP (and in <uri> tag in tld) is
> 
>      http://java.sun.com/jsp/jstl/core
> 
> how does the container find the classes in /WEB-INF/lib/jstl.jar when 
> the uri points to an outside url? (and the classes are not at this url 
> either..;)

	The tld files in your WEB-INF directory also have a uri.  The
container matches up the uri from your jsp file with one of the uri's
in the tlds.

eric

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: uri question..

Posted by Kris Schneider <kr...@dotech.com>.
maya wrote:
> hi,
> 
> I have been studying taglibs and beans for days now, and am still 
> confused about some things, but for now a simple question (I hope..) re 
> uri:
> 
> let's take JSTL.. the jstl.jar for my app is here..
> 
>    /WEB-INF/lib
> 
> yet the uri for it in taglib directive in JSP (and in <uri> tag in tld) is
> 
>      http://java.sun.com/jsp/jstl/core
> 
> how does the container find the classes in /WEB-INF/lib/jstl.jar when 
> the uri points to an outside url? (and the classes are not at this url 
> either..;)
> 
> hope this question makes sense..  in oreilly (JSP, 3rd ed, ch7) it says 
> the 'uri' attr in taglib directive in JSP is there to find "the class or 
> tag file for each custom action."
> Then in the very next sentence it says, "the attribute contains a string 
> the container uses to locate the TLD for the library.." but it points to 
> a uri for the classes, right? (or tag files..) not the tld..
> 
> (and come to think of it, why is this necessary at all, since the <tag> 
> element in the tld always has a reference to the class (like the web.xml 
> for servlets always contains a ref to the servlet class..) and if using 
> tag files like this:
> 
>     <tag-file>
>       ...
>       <path>/WEB-INF/tags/mytags/copyright.tag</path>
>    </tag-file>
> 
> so, what exactly is the point of the uri and what DOES it point to 
> really?  thank you..
> 
> -m

The JSP 2.0 spec describes the uri attribute like this:

Either an absolute URI or a relative URI specification that uniquely 
identifies the tag library descriptor associated with this prefix.

There are a couple of things to take from that: 1) it's an identifier (not 
a location); 2) it identifies a TLD (not classes - all classes should 
reside in WEB-INF/classes or in JAR files in WEB-INF/lib). Although it's 
common to use a URL for the value of the uri attribute, it's really nothing 
more than an identifier. Think of it as a key in a map where the map values 
are TLDs.

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: uri question..

Posted by Rashmi Rubdi <de...@yahoo.com>.
I think <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  is a namespace declaration. 
   
  With this declaration the namespace prefix is associated with the namespace uri so that the tag processor knows how to handle a JSTL tag when it comes accross it in the JSP page. 
   
  Namespace prefixes are necessary for a few reasons and one of them is that they allow the processor to distinguish between tags that have the same name but belong to different tag libraries, and having different implementation.
   
  For example there can be 
  <c:out value="${myValue}" />
  and 
  <x:out select="$abook/title"/>
   
  Here , the action - out is distinguished by using the namespace prefixes c or x. 

  -Rashmi
  
maya <ma...@yahoo.com> wrote:
  hi,

I have been studying taglibs and beans for days now, and am still 
confused about some things, but for now a simple question (I hope..) re uri:

let's take JSTL.. the jstl.jar for my app is here..

/WEB-INF/lib

yet the uri for it in taglib directive in JSP (and in tag in tld) is

http://java.sun.com/jsp/jstl/core

how does the container find the classes in /WEB-INF/lib/jstl.jar when 
the uri points to an outside url? (and the classes are not at this url 
either..;)

hope this question makes sense.. in oreilly (JSP, 3rd ed, ch7) it says 
the 'uri' attr in taglib directive in JSP is there to find "the class or 
tag file for each custom action."
Then in the very next sentence it says, "the attribute contains a string 
the container uses to locate the TLD for the library.." but it points to 
a uri for the classes, right? (or tag files..) not the tld..

(and come to think of it, why is this necessary at all, since the 
element in the tld always has a reference to the class (like the web.xml 
for servlets always contains a ref to the servlet class..) and if using 
tag files like this:


...

/WEB-INF/tags/mytags/copyright.tag



so, what exactly is the point of the uri and what DOES it point to 
really? thank you..

-m













---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



 		
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out.