[seam-issues] [JBoss JIRA] Created: (SEAMFACES-183) I cannot insert value expressions with the composite components property
luca stancapiano (JIRA)
jira-events at lists.jboss.org
Fri Jul 15 13:43:23 EDT 2011
I cannot insert value expressions with the composite components property
------------------------------------------------------------------------
Key: SEAMFACES-183
URL: https://issues.jboss.org/browse/SEAMFACES-183
Project: Seam Faces
Issue Type: Bug
Components: UI Components
Affects Versions: 3.0.1
Environment: seam 3.0.1 + mojarra 2.0.3.b5
Reporter: luca stancapiano
Fix For: 3.0.1
If I use a value expression in a composite component, it is rejected and moved to a default value. Here an example of a jsp:
<ui:composition ................
xmlns:p="http://java.sun.com/jsf/composite/components/property"
.........
<p:input id="number" label="#{bundles.messages.receipt_number}">
............
</p:input>
<h:button id="cancel" value="#{bundles.messages.template_linkReset}" outcome="/receipt.xhtml"/>
...........
The problem is inside the encodeBegin method of org.jboss.seam.faces.component.UIInputContainer class:
...............
if (!getAttributes().containsKey(getRequiredAttributeName()) && elements.hasRequiredInput()) {
getAttributes().put(getRequiredAttributeName(), true);
}
if (!getAttributes().containsKey(getLabelAttributeName())) {
getAttributes().put(getLabelAttributeName(), generateLabel(elements, context));
}
...............
The containsKey method of the javax.faces.component.UIComponentBase$AttribuetsMap class ignores all keys from a subclass of the UIComponentBase, in our case the UIInputContainer. Doing an:
getAttributes().get(getLabelAttributeName())
we get the correct result. This achievement is showed in the JSF javadocs (http://javaserverfaces.java.net/nonav/docs/2.1/javadocs/javax/faces/component/UIComponentBase.html):
If the attribute name specified as a key matches a property of this UIComponent's implementation class, the following methods will have special behavior:
containsKey - Return false.
get() - If the property is readable, call the getter method and return the returned value (wrapping primitive values in their corresponding wrapper classes); otherwise throw IllegalArgumentException.
put() - If the property is writeable, call the setter method to set the corresponding value (unwrapping primitive values in their corresponding wrapper classes). If the property is not writeable, or an attempt is made to set a property of primitive type to null, throw IllegalArgumentException.
remove - Throw IllegalArgumentException.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list