[
https://issues.jboss.org/browse/SEAMFACES-183?page=com.atlassian.jira.plu...
]
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:
{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:
{quote}
<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>
..............
{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/compo...):
??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.
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:
{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 input composite component property:
{quote}
<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>
..............
{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/compo...):
??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.
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:
{quote}
<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>
..............
{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/compo...):
??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.
For more information on JIRA, see:
http://www.atlassian.com/software/jira