views:

93

answers:

2

I pre-compile some jsp files through ant task of jspc,but it built failed.

errers: info.jsp(35,2) The attribute prefix fn does not correspond to any imported tag library

info.jsp line 35 :

<c:if test="${fn:length(requestScope.checkDetailInfoList) gt 1}">

ant task xml:

<jasper validateXml="false" uriroot="${basedir}/WebRoot" 
      webXmlFragment="${dir.WEB-INF}/generated_web.xml" 
      outputDir="${dir.WEB-INF}/src" />

How should I correct?

+3  A: 

You need to make sure the jsp file imports the fn namespace of the JSTL. You'll need a line that looks something like this in your jsp file:

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

Also, you'll need to make sure the JSTL jars (jstl.jar and standard.jar) are in your classpath when jasper tries to compile.

Asaph
I add the fn "taglib" in the parent pages which included the info.jsp,must declare the taglib in every pages?But the info.jsp pages run Correctly on tomcat
Diablo.Wu
@Diablo.Wu: You should include the taglib in each page that uses it.
Asaph
+2  A: 

Asaph's comments are spot on.

There's one other bit to check: The <fn> tag set was a later addition to the JSTL libraries. Maybe you have an older version of jstl.jar and standard.jar that needs to be updated.

duffymo