Facelet tag parameter not recognized by PrimeFaces p: ajax

I have a simple Facelet tag:

<ui:composition> <ui:insert /> </ui:composition> 

which is used to avoid declaring multiple c:set tags.
Let's say I registered it in the taglib facelets library named view and use it like this:

 <my:view bean="#{myController}"> <p:inputText value="#{bean.value}> <p:ajax event="blur" process="@this" listener="#{bean.handleValueChanged}" /> </p:inputText> </my:view> 

The value attribute is perfectly resolved by p:inputText , but p:ajax produces the following:

 Target Unreachable, identifier 'bean' resolved to null javax.el.PropertyNotFoundException: Target Unreachable, identifier 'bean' resolved to null at com.sun.el.parser.AstValue.getTarget(AstValue.java:153) at com.sun.el.parser.AstValue.invoke(AstValue.java:237) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) at org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxBehaviorListenerImpl.java:47) 

Is this a bug or an expected behavior?

Update : I just tried the same thing with f: ajax and it worked!

Btw, the environment is as follows:
Glassfish 3.1.2
PF 3.0, 3.2, 3.3

Update2 :
This question with RichFaces absolutely identical. This seems to be like a PrimeFaces bug (today I will post a PF bug fix message).

+8
facelets jsf-2 primefaces glassfish-3
source share
2 answers

My colleague just provided a patch to solve this problem.

The current implementation of AjaxBehaviorListenerImpl#processAjaxBehaviour as follows:

 public void processAjaxBehavior(AjaxBehaviorEvent event) throws AbortProcessingException { FacesContext context = FacesContext.getCurrentInstance(); final ELContext elContext = context.getELContext(); try{ listener.invoke(elContext, new Object[]{}); } catch (MethodNotFoundException mnfe) { MethodExpression argListener = context.getApplication().getExpressionFactory(). createMethodExpression(elContext, listener.getExpressionString(), null, new Class[]{event.getClass()}); argListener.invoke(elContext, new Object[]{event}); } } 

He suggests setting it up as follows:

 import javax.faces.view.facelets.FaceletContext; 

 public void processAjaxBehavior(AjaxBehaviorEvent event) throws AbortProcessingException { FacesContext context = FacesContext.getCurrentInstance(); final ELContext elContext = context.getELContext(); try{ listener.invoke(elContext, new Object[]{}); } catch (MethodNotFoundException mnfe) { FaceletContext fc = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY); MethodExpression argListener = context.getApplication().getExpressionFactory(). createMethodExpression(fc, listener.getExpressionString(), null, new Class[]{ event.getClass() }); argListener.invoke(elContext, new Object[]{ event }); } } 

Hope this will be approved by the PF team.

+4
source share

The setup does not work with my use case, which is more complicated than one ui: include.

 <c:forEach items="#{items}" var="item"> <ui:include src="#{item.uri}"> <ui:param name="itemBean" value="#{item.bean}"/> </ui:include> </c:forEach> 

I think the listener display variable should be reused inside the new Expression method

-one
source share

All Articles