Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSPX namespaces not visible for EL functions?

Tags:

xml

jsp

el

taglib

jspx

I'm attempting to use JSPX (pure XML syntax for JSP) and running into what seems like it should work, but doesn't. I'm importing taglibs using namespace declarations in the jsp:root element, then using these later on for elements as well as EL functions:

<jsp:root version="2.0"
    xmlns:jsp="http://java.sun.com/JSP/
    xmlns:c="urn:jsptld:/WEB-INF/tld/c.tld"
    xmlns:fn="urn:jsptld:/WEB-INF/tld/fn.tld">
    ...
    <c:if test="${fn:length(list) &gt; 0">
        ...
    </c:if>
    ...
</jsp:root>

I get an exception saying "The attribute prefix fn does not correspond to any imported tag library". Other pages work fine, but this page differs in that it uses a few EL functions contained in a tag library.

Is there a different kind of import I need that will bring these taglib prefixes into a scope that's visible for EL function calls?

like image 526
Alan Krueger Avatar asked Dec 11 '25 12:12

Alan Krueger


1 Answers

Why don't you use the full TLD URI? You can find here an overview of the valid JSTL TLD URI's (click at any JSTL taglib of your interest to get the valid declaration examples).

To be sure: you have placed the JSTL JAR file(s) (jstl.jar and/or standard.jar, depending on JSTL version, until with 1.1 it's both and in 1.2 it's only jstl.jar) in the classpath and you did not extract them nor cluttered the classpath and/or web.xml with loose files and declarations as some poor online tutorials say?

like image 152
BalusC Avatar answered Dec 13 '25 01:12

BalusC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!