tags:

views:

139

answers:

2

I am using RAD 6.0, where I have put jstl.jar under the lib folder in my application. When I am using the JSTL tags, it does not give any copilation errors. But when I am trying to run the application, the core tags are not working.

A: 

RAD 6 / WAS 6 is Servlet 2.4 targeted. Thus:

  1. Ensure that you've included both jstl.jar and standard.jar of JSTL 1.1 in webapp's classpath (the /WEB-INF/lib folder).

  2. Ensure that you're declaring taglibs in top of JSP files as per JSTL 1.1 tlddoc (click any of libs to see them). E.g.

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

    Especially note presence of /jsp in path and also the absence of the _rt prefix in name.

  3. Ensure you've declared web.xml as per Servlet 2.4 spec (and thus not as Servlet 2.3 or older).

    <web-app
        xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">
    
BalusC
I have both jstl as well as standard.jar, under my web app.But after I have made the above mentioned change I am having following errors in web.xml.1) Attribute "xmlns:xsi" must be declared for element type "web-app".
Aparajita Hait
2) cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name, "http://java.sun.com/xml/ns/j2ee":icon, "http://java.sun.com/xml/ns/j2ee":distributable, "http://java.sun.com/xml/ns/j2ee":context-param, "http://java.sun.com/xml/ns/j2ee":filter, "http://java.sun.com/xml/ns/j2ee":filter-mapping, "http://java.sun.com/xml/ns/j2ee":listener, "http://java.sun.com/xml/ns/j2ee":servlet, "http://java.sun.com/xml/ns/j2ee":servlet-mapping, "http://java.sun.com/xml/ns/j2ee":session
Aparajita Hait
-config, "http://java.sun.com/xml/ns/j2ee":mime-mapping, "http://java.sun.com/xml/ns/j2ee":welcome-file-list, "http://java.sun.com/xml/ns/j2ee":error-page, "http://java.sun.com/xml/ns/j2ee":jsp-config, "http://java.sun.com/xml/ns/j2ee":security-constraint, "http://java.sun.com/xml/ns/j2ee":login-config, "http://java.sun.com/xml/ns/j2ee":security-role, "http://java.sun.com/xml/ns/j2ee":env-entry, "http://java.sun.com/xml/ns/j2ee":ejb-ref, "http://java.sun.com/xml/ns/j2ee":ejb-local-ref, "http://java.sun.com/xml/ns/j2ee":service-
Aparajita Hait
ref, "http://java.sun.com/xml/ns/j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, "http://java.sun.com/xml/ns/j2ee":message-destination-ref, "http://java.sun.com/xml/ns/j2ee":message-destination, "http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is expected. Am not sure what to do.
Aparajita Hait
Ordering of the elements in `web.xml` is strict in Servlet 2.4. Easiest would be to have RAD autogenerate the `web.xml` for you.
BalusC
A: 

You should add the jstl.jar to the Java Build Path in the Project Properties of the particular project.

Be aware that Java Build Path and MANIFEST.MF (for runtime Classpath) can get out-of-sync at some point. Therefore it is better to use Rational Application Developer 7.0 or 7.5 which also support WebSphere Application Server 6.0.

Also, Rational Application Developer 6.0 is out-of-support already: http://www-111.ibm.com/software/support/lifecycle/PLCDetail.wss?brand=rational&amp;synkey=W170532D29019M02-L603472G19375Q17-M054243E02973V75&amp;synkey=W170532D29019M02-L603472G19375Q17-R377236X92964B60&amp;synkey=W170532D29019M02-T872435L09150T44-O941388U48112Q95&amp;ibm-view=View+details

The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

Michael Grosse
Just dropping in `/WEB-INF/lib` enough. It's already part of the classpath/buildpath.
BalusC