错误属性 select 不支持 <x:out select> 中的任何表达式

Error attribute select does not support any expression in <x:out select>

<x:out select="$node/${pram.foo}" />

显示错误根据标记文件中的 TLD 或属性指令,属性 select 不接受任何表达式

其中 foo 是传入 url 的参数,例如 http://localhost/foo=bar

如何解决?

更新

<!DOCTYPE html>
<html>
    <head>
        <%@include file="WEB-INF/jspf/common.jspf" %>
    <c:import url="WEB-INF/data/Plan.xml" var="planDoc" charEncoding="utf-8"/>
    <x:parse  xml="${planDoc}" var="plans"/>

common.jspf

<%@ page pageEncoding="UTF-8" %>

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

看来您真的不能在 x:outselect 元素中使用 EL 表达式(例如 ${param.foo})。相反,您可以使用这样的普通变量:

    <c:set var="foo" value="${param.foo}" />
    <x:out select="$node/$foo" /> 

另请参阅:

  • does not accept a variable
  • Error using JSTL XML taglib - attribute xml does not accept any expressions