JSP works, JSTL doesn't

Discussion in 'Java' started by Robert Metzger, Sep 23, 2005.

  1. I am trying to use JSTL with JSP.
    I have Tomcat 4.1.31 installed and it responds properly to access
    ..jsp's for my application. It processes pages with standard JSP tags
    (such as jsp:include) correctly.

    However, when I try to use JSTL tags, either to access the standard-examples,
    or to access my application, I get errors.

    I am following the instructions in
    java.sun.com/developer/technicalArticles/javaserverpages/faster/index.html
    "Faster Development with JavaServer Pages Standard Tag Library"

    I have installed jakarta-taglibs-standard-1.1.2, and copied jstl.jar and
    standard.jar to ../webapp/myappname/WEB-INF/lib

    For example, I click through to standard-examples/elsupport/Out.jsp
    and get the following message:

    org.apache.jasper.JasperException:
    This absolute uri (http://java.sun.com/jsp/jstl/core) cannot be resolved in
    either web.xml or the jar files deployed with this application

    Checking

    .../web/jakarta-tomcat-4.1.31/webapps/standard-examples/WEB-INF/lib
    jstl.jar
    standard.jar

    .../web/jakarta-tomcat-4.1.31/webapps/myappname/WEB-INF/lib
    jstl.jar
    standard.jar

    The files are identical between the directories.

    If I access the following stub page from my application

    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <body>
    <c:eek:ut value="${header['User-Agent']}"/>
    </body>
    </html>

    I get the following error message:

    org.apache.jasper.JasperException:
    /e.jsp(4,0) No such tag out in the tag library imported with prefix c

    Thanks for any suggestions on getting JSTL working.
    --
    Robert Metzger
    Hewlett-Packard Company
    High Performance Computing Division
     
    Robert Metzger, Sep 23, 2005
    #1
    1. Advertising

  2. (Robert Metzger) writes:

    > I have installed jakarta-taglibs-standard-1.1.2, and copied jstl.jar and
    > standard.jar to ../webapp/myappname/WEB-INF/lib


    But have you also added a taglib.tld to the app and altered web.xml to
    point at the taglib?

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


    This should be complemented by

    <taglib>
    <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/tlds/jstl.tld</taglib-location>
    </taglib>

    or the like in your webapp.
     
    Tor Iver Wilhelmsen, Sep 23, 2005
    #2
    1. Advertising

  3. Tor Iver Wilhelmsen wrote:
    > (Robert Metzger) writes:
    >
    >> I have installed jakarta-taglibs-standard-1.1.2, and copied jstl.jar and
    >> standard.jar to ../webapp/myappname/WEB-INF/lib

    >
    > But have you also added a taglib.tld to the app and altered web.xml to
    > point at the taglib?


    Where do you get the .tld? And why doesn't any documentation or
    tutorial mention this? (just wondering, since I got the same error, and
    nobody knew a solution)

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

    >
    > This should be complemented by
    >
    > <taglib>
    > <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
    > <taglib-location>/WEB-INF/tlds/jstl.tld</taglib-location>
    > </taglib>
    >
    > or the like in your webapp.


    So you need to create a tld file? What does it look like?

    --
    My mouth says the words, my brain is thinking monstertrucks.
    Joey (Friends)
     
    Ulrich Hobelmann, Sep 24, 2005
    #3
  4. Ulrich Hobelmann <> writes:

    > Where do you get the .tld?


    In the distribution.

    > And why doesn't any documentation or
    > tutorial mention this?


    Sun's tutorial does:

    http://www.developer.com/java/ejb/article.php/1447551

    "Copy the JSTL TLD files to Tomcat's web-inf directory.

    The web-inf directory is likely at this location: C:\Program
    Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF. If you examine the JSTL
    distribution files, you should notice eight files that end with the
    TLD extension. All eight files should be copied to your web-inf
    directory."
     
    Tor Iver Wilhelmsen, Sep 24, 2005
    #4
  5. Ulrich Hobelmann, Sep 24, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. asj
    Replies:
    0
    Views:
    368
  2. Robert Mark Bram

    Custom JSTL that accepts JSTL expression

    Robert Mark Bram, Dec 15, 2004, in forum: Java
    Replies:
    0
    Views:
    977
    Robert Mark Bram
    Dec 15, 2004
  3. P.Hill
    Replies:
    2
    Views:
    5,037
    P.Hill
    Jun 7, 2005
  4. Replies:
    0
    Views:
    4,419
  5. DaFoot
    Replies:
    1
    Views:
    1,705
    DaFoot
    Oct 23, 2008
Loading...

Share This Page