views:

58

answers:

1

I'm using:

  • Tomcat 6.0
  • Jsf 1.2 - Mojarra Implementation
  • Tomahawk 1.1.9

I imported the taglib

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

when i call:

<h:outputText value="#{fn:indexOf('ciao','i')}"></h:outputText>

Output is 1

when i use

<t:outputText value="#{fn:indexOf('ciao','i')}"></t:outputText>

it throws a server exception, like there are some problems referencing right library.

javax.el.ELException: Function 'fn:indexOf' not found
    at org.apache.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:171)
    at org.apache.el.parser.SimpleNode.accept(SimpleNode.java:145)
    at org.apache.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:133)
    at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:147)

Any hint? Thank you everybody for help :)

+1  A: 

I was able to reproduce exactly this problem with Mojarra 1.2_14 and Tomahawk 1.1.9 on Tomcat 6.0.18. The same problem also occurred at Tomcat 6.0.20, although the line numbers of the org.apache.el.* methods in the stacktrace were slightly different.

To exclude Tomcat's jsp-el from being suspect, I tested at Glassfish v3 as well, which is using a different EL impl. It produced basically the same exception, although with different EL classes in stacktrace (com.sun.el.* instead of org.apache.el.*).

Interesting fact is however that it indeed works flawlessly when using Facelets instead of JSP, as commented by Bozho. This would mean that the JSP EL implementations of both Tomcat and Glassfish are broken.

I would start filing an issue for Tomcat 6 here http://tomcat.apache.org/bugreport.html and see what the Apache guys says about this.

BalusC
Thank you BalusC. I will file the strange behaviour in tomcat bug repository. It's a pleasure to know you. Many things i learned from your blog! Let's hope to solve this issue. I used a workaround for now. I used <f:verbatim rendered=""> to show or not some result.
M3rlino