[seam-issues] [JBoss JIRA] Updated: (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:45:23 EDT 2011


     [ https://issues.jboss.org/browse/SEAMFACES-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

luca stancapiano updated SEAMFACES-183:
---------------------------------------

    Description: 
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:
{quote}
<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"/>
...........
{quote}




The problem is inside the encodeBegin method of org.jboss.seam.faces.component.UIInputContainer class:

{quote}
...............

        if (!getAttributes().containsKey(getRequiredAttributeName()) && elements.hasRequiredInput()) {
            getAttributes().put(getRequiredAttributeName(), true);
        }

        if (!getAttributes().containsKey(getLabelAttributeName())) {
            getAttributes().put(getLabelAttributeName(), generateLabel(elements, context));
        }

...............
{quote}

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:

{quote}
getAttributes().get(getLabelAttributeName())
{quote}

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

{quote}
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.
{quote}

  was:
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.




> 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:
> {quote}
> <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"/>
> ...........
> {quote}
> The problem is inside the encodeBegin method of org.jboss.seam.faces.component.UIInputContainer class:
> {quote}
> ...............
>         if (!getAttributes().containsKey(getRequiredAttributeName()) && elements.hasRequiredInput()) {
>             getAttributes().put(getRequiredAttributeName(), true);
>         }
>         if (!getAttributes().containsKey(getLabelAttributeName())) {
>             getAttributes().put(getLabelAttributeName(), generateLabel(elements, context));
>         }
> ...............
> {quote}
> 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:
> {quote}
> getAttributes().get(getLabelAttributeName())
> {quote}
> 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): 
> {quote}
> 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.
> {quote}

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