Search code examples
jsfjstl

JSTL functions is not found in JSF


I am trying to add an active class on the page the user is currently viewing but I can't manage to use the JSTL functions. What am I doing wrong?

xmlns:fn="http://java.sun.com/jstl/functions"

Using this in a h:link

styleClass="#{fn:containsIgnoreCase(request.requestURI,'index') ? 'active' : ''}"

causes this error:

styleClass="#{fn:containsIgnoreCase(request.requestURI,'index')}" Function 'fn:containsIgnoreCase' not found

Solution

  • You've got wrong import, it should be :

    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    

    You forgot about /jsp