Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any good reason to use <rtexprvalue>false</rtexprvalue> in JSP tags?

Tags:

java

jsp

jsp-tags

Is there any good reason to disallow scriptlet or EL expression to be inserted as attribute value?

Let's say we have tag:

<tag>
    <name>mytag</name>
    <tag-class>org.apache.beehive.netui.tags.tree.Tree</tag-class>
    <attribute>
        <name>attr</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <type>boolean</type>
    </attribute>
</tag>

What could be a good reason for dissallowing the below?

<my:mytag attr="${setting}" />
like image 924
Andrey Adamovich Avatar asked Mar 29 '10 09:03

Andrey Adamovich


1 Answers

I'd say it is mostly a backwards-compatibility measure, just like the ability to turn off EL completely for a given JSP.

Maybe the tag library existed before EL, and uses the special syntax ${} for its own purposes. Maybe the attribute value frequently takes values that include a literal ${}.

Without such a setting, existing code (in the tag library or the JSP) would need to be modified in order to still work after upgrading to the latest version of the Servlet spec.

like image 116
Thilo Avatar answered Sep 18 '22 15:09

Thilo