使用JSTL XML taglib时出错-属性xml不接受任何表达式 [英] Error using JSTL XML taglib - attribute xml does not accept any expressions

查看:224
本文介绍了使用JSTL XML taglib时出错-属性xml不接受任何表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用JSTL XML taglib时出现以下错误:

I'm getting the following error when I try to use the JSTL XML taglib:

/server-side-transform.jsp(51,0) 
According to TLD or attribute directive in tag file,
attribute xml does not accept any expressions

我正在研究tlds等,但是如果有人知道这可以节省我一些时间,那将不胜感激!

I'm looking into the tlds etc, but if anyone knows what this is an can save me some time, it'd be appreciated!

如果有帮助,运行示例代码会出现此错误

If it helps, I get this error 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}"/>

我的/server-side-transform.jsp中-我的taglib指令是:

in my /server-side-transform.jsp - my taglib directives are:

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>

我确实在/ WEB-INF / lib中有standard.jar和jstl.jar。

and I do have standard.jar and jstl.jar in /WEB-INF/lib.

推荐答案

您的代码正在获取x-1_0.tld的错误版本,这可能是由于类路径问题引起的。例如,在我当前的类路径上,我看到一个x-1_0.tld版本,该版本允许在此标记中运行时表达式$ {syntax},而没有。 standard.jar中的一个不允许EL表达式,而我在码头上的一个不允许。

Your code is picking up an "incorrect" version of x-1_0.tld, probably due to classpath issues. I see for instance on my current classpath, I have one version of x-1_0.tld that ALLOWS runtime-expressions ${syntax} in this tag and one that does not. The one in standard.jar does not allow EL expressions, while the one I have in jetty does.

这篇关于使用JSTL XML taglib时出错-属性xml不接受任何表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆