Java – JSTL support in Weblogic

jakarta-eejavajstlweb.xmlweblogic

Im trying to start working with Java EE using Weblogic, and i cant make JSTL tags work, in simpliest code i get the following errors when deploying my application:

index.jsp:1:4: No tag library could be
found with this URI. Possible causes
could be that the URI is incorrect, or
that there were errors during parsing
of the .tld file. <%@taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core"%>

^—-^ index.jsp:1:4: No tag
library could be found with this URI.
Possible causes could be that the URI
is incorrect, or that there were
errors during parsing of the .tld
file. <%@taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core"%>

^—-^ index.jsp:2:4: No tag
library could be found with this URI.
Possible causes could be that the URI
is incorrect, or that there were
errors during parsing of the .tld
file. <%@taglib prefix="sql"
uri="http://java.sun.com/jsp/jstl/sql"%>

^—-^ index.jsp:2:4: No tag
library could be found with this URI.
Possible causes could be that the URI
is incorrect, or that there were
errors during parsing of the .tld
file. <%@taglib prefix="sql"
uri="http://java.sun.com/jsp/jstl/sql"%>

I downloaded taglib files from this website: http://archive.apache.org/dist/jakarta/taglibs/standard/
and put two jars(standard.jar and jstl.jar) under my WEB-INF directory. I also put there all the tld files from the arcihve.
Ater that i tried referencing them in my web.xml file and after validation i get the following error:

XML validation started. Checking
file:/C:/Users/Brodyaga/Documents/NetBeansProjects/Eshop1/web/WEB-INF/web.xml…
Referenced entity at
"nbres:/org/netbeans/modules/j2ee/ddloaders/catalog/resources/XMLSchema.dtd".
Referenced entity at
"nbres:/org/netbeans/modules/j2ee/ddloaders/catalog/resources/datatypes.dtd".
cvc-complex-type.2.4.a: Invalid
content was found starting with
element 'taglib'. One of
'{"http://java.sun.com/xml/ns/javaee":description,
"http://java.sun.com/xml/ns/javaee":display-name,
"http://java.sun.com/xml/ns/javaee":icon,
"http://java.sun.com/xml/ns/javaee":distributable,
"http://java.sun.com/xml/ns/javaee":context-param,
"http://java.sun.com/xml/ns/javaee":filter,
"http://java.sun.com/xml/ns/javaee":filter-mapping,
"http://java.sun.com/xml/ns/javaee":listener,
"http://java.sun.com/xml/ns/javaee":servlet,
"http://java.sun.com/xml/ns/javaee":servlet-mapping,
"http://java.sun.com/xml/ns/javaee":session-config,
"http://java.sun.com/xml/ns/javaee":mime-mapping,
"http://java.sun.com/xml/ns/javaee":welcome-file-list,
"http://java.sun.com/xml/ns/javaee":error-page,
"http://java.sun.com/xml/ns/javaee":jsp-config,
"http://java.sun.com/xml/ns/javaee":security-constraint,
"http://java.sun.com/xml/ns/javaee":login-config,
"http://java.sun.com/xml/ns/javaee":security-role,
"http://java.sun.com/xml/ns/javaee":env-entry,
"http://java.sun.com/xml/ns/javaee":ejb-ref,
"http://java.sun.com/xml/ns/javaee":ejb-local-ref,
"http://java.sun.com/xml/ns/javaee":service-ref,
"http://java.sun.com/xml/ns/javaee":resource-ref,
"http://java.sun.com/xml/ns/javaee":resource-env-ref,
"http://java.sun.com/xml/ns/javaee":message-destination-ref,
"http://java.sun.com/xml/ns/javaee":persistence-context-ref,
"http://java.sun.com/xml/ns/javaee":persistence-unit-ref,
"http://java.sun.com/xml/ns/javaee":post-construct,
"http://java.sun.com/xml/ns/javaee":pre-destroy,
"http://java.sun.com/xml/ns/javaee":message-destination,
"http://java.sun.com/xml/ns/javaee":locale-encoding-mapping-list}'
is expected. [12] XML validation
finished.

My web.xml goes as following:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

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

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

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

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

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

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

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

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
        <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
    </taglib>
</web-app>

I believe that xml schema specified in the beginning of web.xml doesnt allow taglib tags, but i have no idea what schema i should use.

I'd really apprectiate some step by step tutorial for adding jstl support to weblogic. Thanks in advance.

UPDATE
Removing those <taglib>'s from web.xml ends up with erros such as following:

index.jsp:18:14: The tag handler class
was not found
"org.apache.taglibs.standard.tag.rt.core.ForEachTag".

and by the contents of c.tld file its clear that weblogic understands that forEach corresponds to org.apache.taglibs.standard.tag.rt.core.ForEachTag, but cant find the class. But i can manually find this class in standard.jar.

Best Answer

You have to include both jstl.jar and standard.jar in the WEB-INF/lib folder, not in the WEB-INF folder. I guess that will solve this problem.

Related Topic