Meaningless Drivel is fun!*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Exact location of Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Exact location of ".tld"" Watch "Exact location of ".tld"" New topic
Author

Exact location of ".tld"

Yosi Pramajaya
Ranch Hand

Joined: Jun 30, 2011
Posts: 46

Hello, I want to take an OCEWCD Java EE 6.
But, I want to ask something when I learn from a book.

Where's the exact location of a .tld files?
I've read a topic, that said it only can be located in WEB-INF directory or it's subdirectory.

But I've read here Oracle's DOCS.
That said we can include .tld in META-INF directory or it's subdirectory.

Now, what's the exact position of .tlds?

Independent Programmer - Technology Enthusiast - JUG Leader from JUG Joglosemar
Gaurangkumar Khalasi
Ranch Hand

Joined: Jun 02, 2012
Posts: 186
.tld can be located in WEB-INF directory or it's subdirectory and also in META-INF directory or it's subdirectory...
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

Yosi Pramajaya wrote:Hello, I want to take an OCEWCD Java EE 6.
But, I want to ask something when I learn from a book.

Where's the exact location of a .tld files?
I've read a topic, that said it only can be located in WEB-INF directory or it's subdirectory.

But I've read here Oracle's DOCS.
That said we can include .tld in META-INF directory or it's subdirectory.

Now, what's the exact position of .tlds?


You said you want to appear for OCEWCD 6 but i see that you are referring javadocs for j2ee 1.4. i recommend you reading tutorials for java ee 6 which is available on oracle site in pdf as well as html format
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1629
    
  23

Hi Guys,

To be a little more precise, these are the general rules:

The TLD file
Explicit mapping:
the taglib directive in a JSP-file has an URI that corresponds with a <taglib-uri> in the <taglib> element of the web.xml. The location of the TLD file is found in the <taglib-location> element.

Implicit mapping:
the taglib directive in a JSP-file has an URI that doesn't match any <taglib-uri> in the <taglib> element of the web.xml. The JSP container gets the location by searching the subdirectories of /WEB-INF and the jar's in /WEB-INF/lib for a TLD file with a matching URI.

  • the fallback rule allows a taglib directive to refer directly to the TLD. This arrangement is very convenient for quick development at the expense of less flexibility and accountability. For example: <%@ taglib uri="/WEB-INF/tlds/PRlibrary_1_4.tld" prefix="x" %>


  • The URI in the taglib directive doesn't point to anything (with exception of the fallback-rule) it only has to match the corresponding <taglib-uri> setting in the web.xml or the optional <uri> attribute in the TLD-file.


  • The .tld files within a jar file must have a path that begins with /META-INF


  • Regards,
    Frits
    vipul bondugula
    Ranch Hand

    Joined: Oct 14, 2010
    Posts: 218
    Frits Walraven wrote:Hi Guys,

    To be a little more precise, these are the general rules:

    The TLD file
    Explicit mapping:
    the taglib directive in a JSP-file has an URI that corresponds with a <taglib-uri> in the <taglib> element of the web.xml. The location of the TLD file is found in the <taglib-location> element.

    Implicit mapping:
    the taglib directive in a JSP-file has an URI that doesn't match any <taglib-uri> in the <taglib> element of the web.xml. The JSP container gets the location by searching the subdirectories of /WEB-INF and the jar's in /WEB-INF/lib for a TLD file with a matching URI.

  • the fallback rule allows a taglib directive to refer directly to the TLD. This arrangement is very convenient for quick development at the expense of less flexibility and accountability. For example: <%@ taglib uri="/WEB-INF/tlds/PRlibrary_1_4.tld" prefix="x" %>


  • The URI in the taglib directive doesn't point to anything (with exception of the fallback-rule) it only has to match the corresponding <taglib-uri> setting in the web.xml or the optional <uri> attribute in the TLD-file.


  • The .tld files within a jar file must have a path that begins with /META-INF


  • Regards,
    Frits



    what frits said , those rules are in J2EE 1.4.. In J2EE 6, drop your tld file in WEB-INF (or) sub-directory of WEB-INF (or) in META-INF. refer the tld file in jsp using uri in tld file. server is smart enough to detect the tld file. instead of uri, can also use tld location.


    Thanks
    Vipul Kumar
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Bartender

    Joined: Apr 07, 2010
    Posts: 1629
        
      23

    what frits said , those rules are in J2EE 1.4.. In J2EE 6, drop your tld file in WEB-INF (or) sub-directory of WEB-INF (or) in META-INF. refer the tld file in jsp using uri in tld file. server is smart enough to detect the tld file. instead of uri, can also use tld location.


    If you check the JSP 2.2 specs which is part of EE6, you will still find all of the general rules (from JSP.7.3 The Tag Library Descriptor onwards)

    Regards,
    Frits
    vipul bondugula
    Ranch Hand

    Joined: Oct 14, 2010
    Posts: 218
    Frits Walraven wrote:

    If you check the JSP 2.2 specs which is part of EE6, you will still find all of the general rules (from JSP.7.3 The Tag Library Descriptor onwards)

    Regards,
    Frits


    I thought J2EE 6 has jsp 2.3 specification.Thanks Frits , for correcting me.
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Bartender

    Joined: Apr 07, 2010
    Posts: 1629
        
      23

    I thought J2EE 6 has jsp 2.3 specification.Thanks Frits , for correcting me.

    No problem, I always use the following page:

    Java EE 6 Technologies

    Regards,
    Frits

     
    Don't get me started about those stupid light bulbs.
     
    subject: Exact location of ".tld"
     
    Similar Threads
    Location of tld files
    Location of .tld file
    Still TLD confusion
    TLD file
    can I do this in tlds, uris and taglibs?