[richfaces-issues] [JBoss JIRA] (RF-12353) Incorrect documentation/taglib on <a4j:param>

Alexander Kiselyov (JIRA) jira-events at lists.jboss.org
Fri Jul 6 07:22:12 EDT 2012


Alexander Kiselyov created RF-12353:
---------------------------------------

             Summary: 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.2.Final, 4.2.0.Final
         Environment: no matter
            Reporter: Alexander Kiselyov
            Priority: Minor


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_Reference/en-US/html_single/#sect-Component_Reference-Actions-a4jparam] has only two sentences about it, which are *very easy to miss*.
Also, [RichFaces Showcase|http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=param&sample=clientParam&skin=blueSky] 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: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list