[richfaces-issues] [JBoss JIRA] (RF-11469) autocomplete method does not resolve bean if ui:included

Valiantsin Shukaila (JIRA) jira-events at lists.jboss.org
Thu Jun 13 07:15:55 EDT 2013


    [ https://issues.jboss.org/browse/RF-11469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781378#comment-12781378 ] 

Valiantsin Shukaila commented on RF-11469:
------------------------------------------

I am having such problem with 4.3.1 version of Richfaces.
The Problem is that by default autoCompleteMethod seems to be defined with 3 parameters: FacesContext,UIComponent,String. 
This can be seen from here:
{code} 
try {
    // String value = getInputValue(facesContext, component);
    itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[] { facesContext, component, value });
    } catch (MethodNotFoundException e) {
       ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
       autocompleteMethod = expressionFactory.createMethodExpression(facesContext.getELContext(),autocompleteMethod.getExpressionString(), Object.class, new Class[] { String.class });
       itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[] { value });
    }
{code}
One can see that if method with 3 arguments is not found(actually it is not clear why it is 3 arguments, they are useless) just exception is caught and new MethodExpression is created. But this new MethodExpression doesn't take in account all facelet compositions so beans passed as parameters would not be resolved in this new method expression.
So I see the easiest workaround for this: change method declaration in the bean so that it would have 3 arguments (FacesContext, UIComponent, String). 
For me this worked well.
Actually it's a pity that almost 2 years passed after this issue was found and it is still not resolved. Actually I have such a bad feeling with all richfaces 4 version. Seems nobody supports it now?
                
> autocomplete method does not resolve bean if ui:included
> --------------------------------------------------------
>
>                 Key: RF-11469
>                 URL: https://issues.jboss.org/browse/RF-11469
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-input
>    Affects Versions: 4.0.0.Final
>            Reporter: u j
>             Fix For: 5-Tracking
>
>
> A bean parameter in the autocomplete method is not resolved if the rich:autocomplete is part of a ui:include.
> {code}
> <ui:include src="/searchlocation.xhtml">
>      <ui:param name="bean" value="#{searchBean}" />
> </ui:include>
> {code}
> searchlocation.xhtml contains:
> {code}
> <rich:autocomplete id="cityName"  mode="ajax" value="#{bean.cityName}" autocompleteMethod="#{bean.suggestCities}" />
> {code}
> The value binding works, but the binding in the autocompleteMethod gives:
> {code}
> 15:26:15,809 SEVERE [org.richfaces.log.Renderkit] (ajp-127.0.0.1-127.0.0.1-8009-1) Target Unreachable, identifier 'bean' resolved to null: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'bean' resolved to null
>     at org.apache.el.parser.AstValue.getTarget(AstValue.java:75) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
>     at org.apache.el.parser.AstValue.invoke(AstValue.java:183) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
>     at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
>     at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
>     at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
>     at org.richfaces.renderkit.AutocompleteRendererBase.getItems(AutocompleteRendererBase.java:105) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
>     at org.richfaces.renderkit.AutocompleteRendererBase.encodeItems(AutocompleteRendererBase.java:160) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
>     at org.richfaces.renderkit.AutocompleteRendererBase.encodeMetaComponent(AutocompleteRendererBase.java:271) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the richfaces-issues mailing list