Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jasper in Jetty 6 throws exception for JSTL tag

Tags:

jstl

jetty

I'm trying to run an application in jetty that runs fine in Tomcat 5.5. The app uses servlet 2.4 and JSP 2.0.

Jetty/Jasper is throwing this exception:

org.apache.jasper.JasperException: /WEB-INF/tiles/layout/main.jsp(85,55) PWC6340: According to the TLD, rtexprvalue is true, and deferred-value is specified for the attribute items of the tag handler org.apache.taglibs.standard.tag.rt.core.ForTokensTag, but the argument for the setter method is not a java.lang.Object

One odd thing, I can't find the TLD anywhere. It seems to be obtaining it by magic that I don't understand. Is it possibly getting a wrong TLD?

It's also hard to tell from where it's loading org.apache.taglibs.standard.tag.rt.core.ForTokensTag. Eclipse doesn't find it in the load path of the project.

Any hints welcome ...

like image 989
Mojo Avatar asked Feb 27 '09 15:02

Mojo


2 Answers

Jetty includes their own JSTL library and there is no need to include jakrta taglib's standard and core jars.

If you do put jakartat taglib's jars into your web application then there is a conflict in the forTokens tag that causes this error while other tags work well. I suggest either remove the jakarta taglib implementation from your web app and rely on Jetty's, or stop using forTokens.

like image 116
Guss Avatar answered Oct 16 '22 09:10

Guss


@Guss is correct, the only way out seems to be to avoid the use of c:forTokens.

example alternative to c:forTokens using c:forEach:

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

<c:forTokens items="${input}" delims="," var="i">
     <!-- do stuff with ${i} -->
</c:forTokens>

<c:forEach items="${fn:split(input,',')}" var="i">
     <!-- do stuff with ${i} -->
</c:forEach>
like image 4
Gareth Davis Avatar answered Oct 16 '22 09:10

Gareth Davis