[
https://issues.jboss.org/browse/SEAMFACES-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jason Porter resolved SEAMFACES-183.
------------------------------------
Resolution: Done
> 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
> Labels: component, composite, property
> 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:
> {code}
> <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"/>
> ...........
> {code}
> The input composite component property:
> {code}
> <ui:composition .............
> xmlns:cc="http://java.sun.com/jsf/composite">
> <cc:interface componentType="org.jboss.seam.faces.InputContainer">
> <cc:attribute name="label" required="true"/>
> ................
> </cc:interface>
> <cc:implementation>
> ..............
> <h:outputLabel id="label" for="" value="#{cc.attrs.label}:"
> styleClass="">
> </h:outputLabel>
> ..............
> {code}
> The problem is inside the encodeBegin method of
> org.jboss.seam.faces.component.UIInputContainer class:
> {code}
> ...............
> if (!getAttributes().containsKey(getRequiredAttributeName()) &&
> elements.hasRequiredInput()) {
> getAttributes().put(getRequiredAttributeName(), true);
> }
> if (!getAttributes().containsKey(getLabelAttributeName())) {
> getAttributes().put(getLabelAttributeName(),
> generateLabel(elements, context));
> }
> ...............
> {code}
> 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:
> {code}
> getAttributes().get(getLabelAttributeName())
> {code}
> 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):
>
> ??citation??
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
seam-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/seam-issues