Error using JTL XML taglib - xml attribute does not accept any expressions
I am getting the following error when I try to use the JSTL XML tag:
/server-side-transform.jsp(51,0)
According to TLD or attribute directive in tag file,
attribute xml does not accept any expressions
I am looking into tlds etc, but if anyone knows this might save me then it would be appreciated!
If it helps, I get this error when running the example code
<c:set var="xml">
<paragraph>
This document uses <bold>unusual</bold> markup,
which we want to replace with <bold>HTML</bold>.
</paragraph>
</c:set>
<c:set var="xsl">
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="paragraph">
<p><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="bold">
<b><xsl:value-of select="."/></b>
</xsl:template>
</xsl:stylesheet>
</c:set>
<x:transform xml="${xml}" xslt="${xsl}"/>
in my / server -side-transform.jsp - my taglib directives:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
and I have standard.jar and jstl.jar in / WEB-INF / lib.
source to share
Your code is picking up the "wrong" version of x-1_0.tld, possibly due to classpath issues. I see, for example, in my current classpath, I have one version x-1_0.tld that ALLOWS runtime-expression $ {syntax} in that tag, and the other doesn't. One in the standard .jar does not allow EL expressions, and the one I have at the dock does.
source to share
I found that Sun documentation refers to URIs as
http://java.sun.com/jsp/jstl/xml
The tag is now being called correctly, so this caused the problem; however i am getting NullPointerException in doEndTag () ... ho hum
source to share
Not really, you should use
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
use JSTL 1.1.
Unfortunately standard.jar files include many versions of the * .tld tag, for example.
- c-1_0-rt.tld
- c-1_0.tld
- c.tld
- fmt-1_0-rt.tld
- fmt-1_0.tld
- fmt.tld
- fn.tld
- permittedTaglibs.tld
- scriptfree.tld
- SQL-1_0-rt.tld
- SQL-1_0.tld
- sql.tld
- x-1_0-rt.tld
- x-1_0.tld
- x.tld
so using
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
you are telling jsp to specifically use JSTL 1.1 which btw fixes the above issue, if that doesn't work try using
<%@ page isELIgnored="false" %>
which basically tells jsp to evaluate EL.
/ Srm
source to share
I realize this question was asked quite a while ago, but I ran into the same problem. In my case, the example below led me to use:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
When should I have used:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
I was looking at the solution for a while until there was an extra jsp in the uri.
source to share
change <% @taglib prefix = "c" uri = "http://java.sun.com/jstl/core"%> doesn't work for me. for my project (web application version = "3.0") IDE (MyEclipse) I can see the x.tld config file. There is a false select that does not allow apperance $ {} or <% =%> to be selected. So I managed to trick the web.xml file.
-
<jsp-config> <taglib> <taglib-uri>/huang</taglib-uri> <taglib-location>/WEB-INF/x.tld</taglib-location> </taglib> </jsp-config>
add to web.xml -
declare new name taglib-url "huang" for my jsp file like this:
<%@ taglib prefix="x" uri="/huang" %>
-
use
<x:out select="$casexml//ζ‘δΎ//${node.name }" />
I can get the correct result
source to share