Announcement Announcement Module
Collapse
No announcement yet.
Is the spring.tld uri accessible via the web? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is the spring.tld uri accessible via the web?

    Is the spring.tld uri accessible via the web?

    To clarify can I specify the taglib location like I can with JSTL:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    or
    do I need to maintain a local copy, as i see in all examples I've found.

    Thanks

  • #2
    from spring.tld:

    Code:
    <uri>http&#58;//www.springframework.org/tags</uri>
    So if you have < 2.4 contrainer all u need is

    Code:
    <%@ taglib prefix="spring" uri="http&#58;//www.springframework.org/tags" %>
    As long you have the spring.jar in lib

    Comment


    • #3
      I am using jboss 3.2.5/tomcat 5.0.?, which is servlet 2.4

      However spring.jar is not in WEB-INF/lib.
      I am deploying my app as an ear, with spring.jar as a jar in the top level ear directory.

      In this case the code above doesn't work, and I need a local copy of spring.tld in WEB-INF.
      Is this because of the location of spring.jar?
      If so, is there any way to get it to work with spring.jar in a different location?

      Comment


      • #4
        Is this because of the location of spring.jar?
        Yes. The TLD can be found implicitly in the META-INF directory of JARs in WEB-INF/lib (you can make it explicit as shown below - relative to WEB-INF):
        Code:
        <taglib>
          <taglib-uri>/springframework</taglib-uri>
          <taglib-location>lib/spring.jar</taglib-location>
        </taglib>
        is there any way to get it to work with spring.jar in a different location?
        Yes. Copy spring.tld into /WEB-INF/tlds. It should be found implicitly, but you can make it explicit by adding the following to the web.xml.
        Code:
        <taglib>
            <taglib-uri>/springframework</taglib-uri>
            <taglib-location>/WEB-INF/tlds/spring.tld</taglib-location>
        </taglib>
        then it can be used as:
        Code:
        <%@ taglib uri=”/springframework” prefix=”spring” %>
        There is a fallback rule with 2.4 that is less flexible, so you could use:
        Code:
        <%@ taglib uri=”/WEB-INF/tlds/spring.tld” prefix=”spring” %>

        Comment


        • #5
          So, if I'm understanding correctly, if spring.jar is outside my webapp's war, or to be more specific, outside WEB-INF, then I must have a copy of the tld file somewhere within the WEB-INF directory structure.

          Thanks for your help,

          Comment

          Working...
          X