javajspjsp-tagsjsp-fragments

Unknown tags and undefined functions in JSP fragments


I imported a web project build in JSP, which I am relatively new to. I got some errors in WEB-INF/includes/components that I am unable to resolve.

Some .jspf files show me errors such as at that line:

<c:if test="${fn:length(view.parent.views) > 1}">

the error is:

Multiple annotations found at this line:
- The function fn:length is 
 undefined
- Unknown tag (c:if).

I also get errors like The function fn:length is undefined errors for fn:length.

I followed up with other questions and made sure that standard.jar and jstl-1.2.jar are included in my build path. Moreover, WEB-INF/includes/taglibs.jspf has the following :

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

Solution

  • It works if I add the following at the beginning of my JSP file:

    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
    <%@ taglib prefix="nav" uri="/WEB-INF/taglibs/navigation.tld" %>
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    

    This is a working answer for now, but I think the best answer would be the one that tells how it can be sufficient to include the lines above in taglibs.jspf, instead of having them in every .jsp file.