views:

68

answers:

2

I've been trying for longer than I'd like to admit to get JSTL working under Eclipse (and ultimately under GAE/J). I've downloaded Eclipse, the Google App Engine Extension for Eclipse, and JSTL (http://download.java.net/maven/1/jstl/jars/ - jstl-1.2.jar is in the WEB-INF\lib directory).

My code is below along with the output:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<HTML><HEAD><TITLE>Test Page</TITLE></HEAD><BODY>
Test Page

<c:set var="myvar" value="3"/>

</BODY></HTML>

The error I get is:

The tag handler class for "c:set" (org.apache.taglibs.standard.tag.rt.core.SetTag) was not found on the Java Build Path 
test.jsp
[my app's path and name]
line 8
JSP Problem

From the last post on this page I don't think I need a standard.jar (http://forums.sun.com/thread.jspa?threadID=701267) and in any case I couldn't find one on the Oracle download.java.com site along with the jstl jar.

EDIT 3:

The top of my web.xml:

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+1  A: 

Ensure that your web.xml root declaration complies at least Servlet 2.4.

<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">

    <!-- Config here. -->

</web-app>

Or if your servletcontainer supports it, prefer 2.5:

<web-app 
    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"
    version="2.5">

    <!-- Config here. -->

</web-app>

Otherwise everything will fall back to least supported modus and taglibs may break like that.

Also ensure that you don't have loose tld files wandering around in the classpath (the /WEB-INF/lib folder, among others), they will collide with the ones in JAR files. Oh, also ensure that you didn't manually define the tlds in web.xml, keep it clean.

BalusC
Hmm, I just get an additional error when I do this:Attribute "xsi:schemaLocation" must be declared for element type "web-app".Attribute "xmlns" must be declared for element type "web-app".Attribute "xmlns:xsi" must be declared for element type "web-app".Attribute "version" must be declared for element type "web-app".
Get rid of that DOCTYPE. This is Servlet 2.3 specific.
BalusC
Still the same error; I created a new project (this time without support for GWT - just GAE) and the web.xml bits you suggested were automatically added but as soon as I add the line <c:set var="myvar" value="3"/> I get the same error...
Did you declare it as servlet 2.4 or 2.5? Your edit is ambiguous. Which version does the servletcontainer support? You should declare the web.xml to match the servletcontainer's maximum supported version. JSTL 1.2 is designed for Servlet 2.5, but does work on Servlet 2.4 when the servletcontainer technically supports 2.5. If the servletcontainer technically doesn't support higher than Servlet 2.4, you need to fall back to JSTL 1.1. It's available [here](http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi). It consists of two JAR files in lib: jstl.jar and standard.jar.
BalusC
Sorry, I didn't remove the old one first. I tried with both 2.4 and 2.5 and I tried adding both to the web.xml first and then to the appengine-web.xml both with no luck. I still get the same error and a null pointer exception if I run it. I'm thinking of trying the Apache implementation (I think the one at java.net is Sun/Oracle's - maybe it doesn't play nice with my version of Eclipse and Google-GAE plugin).
GAE has always been an odd beast. I've never seen problems like that on normal servletcontainers.
BalusC
A: 

As far as i know you need jstl.jar and standard.jar. Put those under WEB-INF/lib.

kukudas