Skip to main content

JSF 2.0 composite:attribute default value vs. EL expression

2 replies [Last post]

I have a simple composit component with an attribute named 'required':

<composite:attribute name="required" required="false" default="false"/>

The problem is when I try to use this component with a 'required' attribute value having EL expression in it, the expression is neglected and the default value is used instead. Example:
<foo:bar required="#{true}"/>

If I remove the default value from the attribute definition it works as expected. If I don't use EL in the value it works as expected. Example:
<foo:bar required="true"/>

I access the value of the attribute in the component implementation like this:
#{cc.attrs.required}<br type="_moz" />

Am I doing something wrong or is this a bug?

JSF version: 2.0.3 and 2.0.4-b5
EL api/impl version: 2.2
Tomcat version: 6.0.29
web.xml context param:

<span class="Apple-tab-span" style="white-space:pre"> </span>&lt;param-name&gt;com.sun.faces.expressionFactory&lt;/param-name&gt;
<span class="Apple-tab-span" style="white-space:pre"> </span>&lt;param-value&gt;com.sun.el.ExpressionFactoryImpl&lt;/param-value&gt;

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-12-01

I have the same problem with Mojarra 2.0.3. I didn't have this problem with Mojarra 2.0.2.
EL api/impl version: 2.0.1
JBoss version: 5.1.0
web.xml context param:


Joined: 2004-05-06

Hello -

I'll take a look at this today since we had some recent interesting "iterations" in this general area of composite attributes and EL expressions..