]
Brian Leathem updated RF-12353:
-------------------------------
Fix Version/s: 4.3.0.Milestone2
Priority: Trivial (was: Minor)
Fixing this should be as simple as adding the @Attribute annotation with generate=false to
the getter of the AbstractParameter conveter getter:
Incorrect documentation/taglib on <a4j:param>
---------------------------------------------
Key: RF-12353
URL:
https://issues.jboss.org/browse/RF-12353
Project: RichFaces
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: component-a4j-core, doc
Affects Versions: 4.2.0.Final, 4.2.2.Final
Environment: no matter
Reporter: Alexander Kiselyov
Priority: Trivial
Labels: String, a4j:param, assignTo, converter
Fix For: 4.3.0.Milestone2
Technical background (RichFaces developers can easy skip it):
----
<a4j:param> performs setting of its value into an expression specified in
"assignTo" attribute. As this component is set as Action listener for
ActionSource parent - org.richfaces.component.AbstractParameter.processAction(ActionEvent)
is called. This method directly retrieves request parameter with this parameter's
name/clientId:
String requestValue =
context.getExternalContext().getRequestParameterMap().get(getName());
and then, if converter's not found, sets it as a value of an expression, specified in
"assignTo":
{code}
if (requestValue != null) {
Class<?> type = updateBinding.getType(elContext);
Converter converter = createConverter(context, type);
...
}
if (null != convertedValue) {
updateBinding.setValue(elContext, convertedValue);
}
{code}
When our expression value has reifiable type, for which JSF (or app developer) has
registered a converter (for instance - Boolean) - all's peachy keen. But when
developer uses, e.g., Map - expression's type (got in
updateBinding.getType(ELContext)) is Object, and we're starting to receive strings in
Map, which is probably parameterized with anything. Also this situation applies to
"non-standard" reference types (user-declared JavaBean, for instance).
{code}
org.richfaces.view.facelets.html.ParameterHandler:
org.richfaces.view.facelets.html.ParameterHandler.ActionParamMetaRule.applyRule(String,
TagAttribute, MetadataTarget):
...
else if ("converter".equals(name)) {
if (attribute.isLiteral()) {
return new LiteralConverterMetadata(attribute.getValue());
} else {
return new DynamicConverterMetadata(attribute);
}
}
...
{code}
I.e. <a4j:param> tag handler designed to accept "converter" attribute,
which can appropriately convert value, passed from client.
----
[a4j:param VDL
Doc|http://docs.jboss.org/richfaces/4.2.X/4.2.2.Final/vdldoc/a4j/param.html] has no
mention of it, and value/assignTo attributes type specified as
"java.lang.Object". a4j.taglib.xml has no mention of it, so developers have no
chance to discover it, e.g., through the content assist, [Rich Component
Reference|http://docs.jboss.org/richfaces/4.2.X/4.2.2.Final/Component_Ref...]
has only two sentences about it, which are *very easy to miss*.
Also, [RichFaces
Showcase|http://showcase.richfaces.org/richfaces/component-sample.jsf?dem...]
contains no example, which uses "converter" attribute.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: