facebook

No added to web.xml for JSTL [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #213811 Reply

    arnor
    Member

    Hi to all
    why when I add jstl on my new project in web.xml there aren’t the tag lib definition?
    ex.
    <taglib>
    <taglib-uri>http://sun&#8230;.</taglib-uri>
    <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>

    are there optional?

    regards Lorenzo

    #213828 Reply

    Riyad Kalla
    Member

    Yes they are, the web spec states that taglib resolution CAN occur in 2 ways:
    1) loading the TLDs from JARs that are in the classpath and using the default URIs defined in the JARs.
    2) Reading the <taglib> entries in your web.xml file

    Struts and JSTL both define default URIs and contain their TLD files in their own JARs, which is why you don’t need to define anything for them, you just need to use the default URIs in your JSP pages when trying to link to them.

    You can find the default URIs by openeing the standard.jar file from JSTL, and then in the META-INF dir, open any of the TLDs you want to load, look near the top and you will see a <uri> tag at the top, for example the c-rt tag has this in it:

    
    <uri>http://java.sun.com/jstl/core_rt</uri>
    

    so in your JSP pages you would do:

    
    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
    

    Of course you can optionall override these defaults by adding <taglib> entries to your web.xml file.

    #213887 Reply

    arnor
    Member

    many thanks Riyad . I understand, now

    regards Lorenzo

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: No added to web.xml for JSTL [Closed]

You must be logged in to post in the forum log in