The question is not which is proper, Brian. I think that both these ways of doing this just confuse new people and are very bad ideas. What I do is this:

        <%@ taglib uri='struts-bean'    prefix='bean' %>

This should make it clear that the "uri" is not a "uri" at all. Most supposed "url" and "uri" are not really those things at all in web work. This is a very fruitful way of confusing newcomers and feeling superior. ///;-)

The value of the uri is simply the value you have put in your web.xml for the tld. For example, my bean taglib has the following tags in the web.xml.

  <taglib>
    <taglib-uri>struts-bean</taglib-uri>
    <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
  </taglib>

I could have put anything in the "uri" that did not conflict with other such "uri". The "uri" is really just a name which references the location of the tld for the tag. There probably is a good reason why they did not have "name" be the tag instead of "uri", but it is not interesting enough for me to investigate.

Hope this helps. The answer is that there is no "proper" way to do this and the usual ways are confusing to new people. I would venture to guess your inquiry is a direct result of the fact that other people have used names for the locations that appear falsely to be syntactically related to locations when in fact they are a meaningless semantic overlay of a location that merely confuses people.

Michael McGrady

At 09:32 AM 5/28/2004, Barnett, Brian W. wrote:
I've seen two different ways to declare taglibs in jsp files:



<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"; %>

<%@ taglib prefix="html" uri="/WEB-INF/lib/struts-html-el.tld" %>



What is the difference between referencing http://blah <http://blah/>  blah
and /WEB-INF/blah blah? Are they interchangeable? How do I know when to use
one over the other?  Also, how should they be specified in the web.xml file,
where I have also seen multiple syntaxes?



Thanks,

Brian Barnett



LEGAL NOTICE

This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you

Reply via email to