Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: JSTL / Jakarta Taglibs Config

3 views
Skip to first unread message

Code Ronin

unread,
May 3, 2003, 12:29:01 AM5/3/03
to
I was hoping someone might point out what will likely turn out to be a
very simple error.

Have a JSP page and added the following taglib:

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

This comes straight from the docs, but I have also tried:

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>

The web-xml has:

<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
</web-app>

Tomcat spews the following error:

javax.servlet.ServletException: Cannot inherit from final class
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

etc., etc.

Comment out the taglib directive and the page comes up fine. Looking
in Tomcat's directories, if the taglib directive is in, the *.java
file is 0 K (showing it did not generate the code).

I just downloaded the latest 4.x Tomcat and 1.0 JSTL (Apr 30th, I
believe). I would appreciate any ideas or pointers.

Thanks in advance.

Sudsy

unread,
May 3, 2003, 9:42:15 AM5/3/03
to
code_...@yahoo.com (Code Ronin) wrote in message news:<67120f77.03050...@posting.google.com>...

Why not this in your JSP:

<%@ taglib uri="core" prefix="c" %>

and this in your web.xml:

<taglib>
<taglib-uri>core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

I don't have the time to dive into the documentation right now
(perhaps you can do that) but including the protocol identifier
(the http:) in the URI sent off alarm bells for me.

Wendy S

unread,
May 3, 2003, 11:10:52 AM5/3/03
to
Sudsy wrote:
> Why not this in your JSP:
> <%@ taglib uri="core" prefix="c" %>
> and this in your web.xml:
> <taglib>
> <taglib-uri>core</taglib-uri>
> <taglib-location>/WEB-INF/c.tld</taglib-location>
> </taglib>
> I don't have the time to dive into the documentation right now
> (perhaps you can do that) but including the protocol identifier
> (the http:) in the URI sent off alarm bells for me.

It should not, it's the proper way to do it on a Servlet 2.3 container. The
tld files are included in the Standard taglib jar files. You just put:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
at the top of the JSP, and the container will find the tld in the .jar file.
Don't put anything in web.xml.

Even though it looks like a URL, it is not, it's just a unique URI, and the
container will not call out over the internet to this address.

On a Servlet 2.2 container, you will have to put them in web.xml.

--
Wendy in Chandler, AZ

Code Ronin

unread,
May 3, 2003, 5:15:21 PM5/3/03
to
> Sudsy wrote:
> > I don't have the time to dive into the documentation right now
> > (perhaps you can do that)

That was a good shot... :)

But, unfortunately, what you read _was_ from the documentation. Thanks
anyway.

Wendy S <wend...@hotmail.com> wrote in message news:<%ZQsa.1829$231.510@fed1read04>...

> It should not, it's the proper way to do it on a Servlet 2.3 container. The
> tld files are included in the Standard taglib jar files. You just put:
> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
> at the top of the JSP, and the container will find the tld in the .jar file.
> Don't put anything in web.xml.

Took the "jsp" out of the taglib directive AND the entry out of the
web.xml -- no dice. Still the same mysterious "Cannot inherit from
final class" exception.

One odd thing is the size of the standard.jar from Apache. The
\standard\lib\standard.jar file is dated 4/30/2003 and 305K in size.
The \standard-1.0\lib\standard.jar file is dated 4/30/2003 and is
2874K in size. And finally, the \standard-1.0.3\lib\standard.jar file
(which is purported to be the latest version) is dated 2/19/2003 and
is 505K.

> On a Servlet 2.2 container, you will have to put them in web.xml.

So I should not have to, as Tomcat 4.x is servlet 2.3. Unfortunately,
... no dice. I just know it is something stupid with my setup, because
this should be a simple "textbook" example. Copy the jars to the lib,
add the taglib to the page, badda-bing, badda-boom, there you go. And
yet, this does not work on THREE Windows 2000 configurations, one of
which has never had Tomcat previously installed. All other aspects of
Tomcat and JSP work.

Thanks Wendy. If you have any other ideas. Maybe I will keep
downloading the nightly builds. See if something changes.

Sudsy

unread,
May 3, 2003, 6:25:56 PM5/3/03
to
Wendy S <wend...@hotmail.com> wrote in message news:<%ZQsa.1829$231.510@fed1read04>...

> Even though it looks like a URL, it is not, it's just a unique URI, and the

> container will not call out over the internet to this address.
>
> On a Servlet 2.2 container, you will have to put them in web.xml.

But Wendy, that's what's frustrating! I mentioned some time ago that
if I try to cycle my tomcat/struts environment when my 'net connection
is down it times-out trying to retrieve the DTDs. IOW, those are real
URLs and an attempt is made to GET them via HTTP. I'd prefer if the
behaviour was consistent. We've probably both read postings of troubles
encountered when the wrong version is specified in the DOCTYPE element.
Either it's a real URL (nothing wrong with the information being cached
locally, however) or it's merely a convenience tag.
Of course I'm still running 2.2 so I haven't yet encountered this
"magical" new behaviour in 2.3. Nothing like backwards compatability,
eh?

Sudsy

unread,
May 3, 2003, 11:42:23 PM5/3/03
to
code_...@yahoo.com (Code Ronin) wrote in message news:<67120f77.03050...@posting.google.com>...

> So I should not have to, as Tomcat 4.x is servlet 2.3. Unfortunately,


> ... no dice. I just know it is something stupid with my setup, because
> this should be a simple "textbook" example. Copy the jars to the lib,
> add the taglib to the page, badda-bing, badda-boom, there you go. And
> yet, this does not work on THREE Windows 2000 configurations, one of
> which has never had Tomcat previously installed. All other aspects of
> Tomcat and JSP work.

Where did you install the standard jar? I ask only because there
was a problem which sounded like it could be related, vis:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3E3935BC.78A17AEE%40mitre.org
Could you take a look at that and see if it's relevant?

Code Ronin

unread,
May 4, 2003, 7:54:20 AM5/4/03
to
bitbu...@hotmail.com (Sudsy) wrote in message news:<3c836f4e.03050...@posting.google.com>...

> code_...@yahoo.com (Code Ronin) wrote in message news:<67120f77.03050...@posting.google.com>...

> Where did you install the standard jar?

> Could you take a look at that and see if it's relevant?

That did the trick. I thought that the documentation sounded wrong
(but hey, it _is_ the docs!):

"To use the Standard Taglib from its Jakarta Taglibs distribution,
simply copy the JAR files in the distribution's 'lib' directory to
your application's WEB-INF/lib directory. The following JAR files are
included in the Standard Taglib distribution and need to be copied to
your application's WEB-INF/lib directory:"

I think I will send the Jakarta Taglibs group a message in order to
get them to update the docs.

Thanks.

0 new messages