java.lang.ClassNotFoundException:使用jstl xml时的org.apache.xpath.VariableStack [英] java.lang.ClassNotFoundException: org.apache.xpath.VariableStack when use jstl xml

查看:58
本文介绍了java.lang.ClassNotFoundException:使用jstl xml时的org.apache.xpath.VariableStack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里有一些代码.

<c:set var="songId" value="${param.songid}"/>
<c:import var="xml" url="WEB-INF/comment.xml" />
<x:parse var="doc" doc="${xml}" scope="session" />
<c:catch var="ex">
<x:forEach var="cmt" select="$doc//*[songId=$songId]" varStatus="counter">
    <li>
        <div class="avacmtSide">
        </div>
        <div class="ctcmtSide">
            <a href="#" style="padding:10px;"><x:out select="$cmt/uploader"/> </a>
            <div style="padding:10px;"><x:out select="$cmt/comment"/> </div>
        </div>
        <div class="clear"></div>
    </li>
</x:forEach>

当我运行它时,出现错误java.lang.ClassNotFoundException:org.apache.xpath.VariableStack. 当我在Google搜索此错误时.人们说那里缺少xalan库.但是我在项目中添加了xalan-2.7.0.jar,它不起作用.知道的人请帮助我.谢谢.

When I run it there is a error java.lang.ClassNotFoundException: org.apache.xpath.VariableStack. When I search google for this error. People said there is missing xalan library. But I have added xalan-2.7.0.jar in my project and it doesn't work. Anyone who know it please help me. Thanks.

推荐答案

变量语法不正确:

 [songId=$songId]

应该是这样:

 "$doc//*[@songId=${pageScope:songId}]"

使用JSTL数据作为XPath变量

Using JSTL Data as XPath Variables

作用域变量可以在XPath表达式($ implicitObject:variableName)中使用,类似于它们在EL中使用的方式($ {implicitObject.variableName}).如果省略了隐式对象,则将按标准顺序搜索范围.请注意,."和"[]"符号不能用于访问bean属性.

Scoped variables can be used in XPath expressions ($implicitObject:variableName) similar to how they are used in EL (${implicitObject.variableName}). If the implicit object is omitted, scopes will be searched in standard order. Note that the "." and "[]" notations cannot be used for accessing bean properties.

参考

JSTL-在xpath中使用变量?

JSTL快速参考

这篇关于java.lang.ClassNotFoundException:使用jstl xml时的org.apache.xpath.VariableStack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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