JSP: using expressions as values to tablib attributes

i am tring to create my own taglib, and pass a jsp variable to the taglib, as an attribute value.

<%@ taglib uri="/WEB-INF/taglib.tld" prefix="custom"%>

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

</custom:printAllPeople>

the tld:

<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>

and i got: org.apache.jasper.JasperException: /filterTagLib.jsp (line: 23, column: 1) According to TLD or attribute directive in tag file, attribute filter does not accept any expressions

how can i use expressions as attribute values?


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

<attribute>
   <name>filter</name>
   <required>true</required>
   <rtexprvalue>true</rtexprvalue>
</attribute>
链接地址: http://www.djcxy.com/p/74680.html

上一篇: 如何在STS 4.3中访问我的自定义jsp taglib?

下一篇: JSP:使用表达式作为tablib属性的值