【问题标题】:JSP: using expressions as values to tablib attributesJSP:使用表达式作为 tablib 属性的值
【发布时间】:2011-10-26 14:01:26
【问题描述】:

我正在尝试创建自己的 taglib,并将 jsp 变量作为属性值传递给 taglib。

<%String myFilter =....; %>
<custom:printAllPeople filter="<%=myFilter%>" >

</custom:printAllPeople>

顶级域名:

<taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>    
    <tag>
        <name>printAllPeople</name>
        <tagclass>jb.taglib.FilterPersonTagLib</tagclass>       
        <attribute>
            <name>filter</name>
            <required>true</required>           
        </attribute>                
        <info>print all people</info>
    </tag>
</taglib>

我得到了: org.apache.jasper.JasperException: /filterTagLib.jsp (line: 23, column: 1) 根据标签文件中的 TLD 或属性指令,属性过滤器不接受任何表达式

如何使用表达式作为属性值?

【问题讨论】:

    标签: jsp taglib


    【解决方案1】:

    您需要在 TLD 属性中使用 rtexprvalue:

    <attribute>
       <name>filter</name>
       <required>true</required>
       <rtexprvalue>true</rtexprvalue>
    </attribute>
    

    【讨论】:

      猜你喜欢
      • 2020-02-13
      • 2011-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      • 2021-07-08
      • 1970-01-01
      相关资源
      最近更新 更多