Hi
I tried the following example:
<h:form id="mainForm">
<test:ajaxPanel2
onRowEditListener="#{ajaxListenerBean.ajaxRender}"
value="#{ajaxListenerBean.value}"/>
</h:form>
ajaxPanel2.xhtml
<cc:interface>
<cc:attribute name="onRowEditListener" required="false"
method-signature="void
listener(javax.faces.event.AjaxBehaviorEvent)"/>
<cc:attribute name="value"/>
</cc:interface>
<cc:implementation>
<test:ajaxContent onRowEditListener="#{cc.attrs.onRowEditListener}">
<h:outputText value="#{cc.attrs.value}" />
</test:ajaxContent>
</cc:implementation>
ajaxContent.xhtml
<cc:interface>
<cc:attribute name="onRowEditListener" required="false"
method-signature="void
listener(javax.faces.event.AjaxBehaviorEvent)"/>
</cc:interface>
<cc:implementation>
<h:commandButton value="Press me">
<f:ajax render="content" listener="#{cc.attrs.onRowEditListener}" />
</h:commandButton>
<h:panelGroup id="content" layout="block">
<cc:insertChildren/>
</h:panelGroup>
</cc:implementation>
@ManagedBean
@RequestScoped
public class AjaxListenerBean
{
private String value;
/*... getter and setter ..*/
public void ajaxRender(AjaxBehaviorEvent evt)
{
value = Double.toString(Math.random());
System.out.println("value ="+value);
}
}
Works without problem. I'm using jetty maven plugin 8.1.3.v20120416 ,
which uses glassfish EL.
There is no evidence so far that there is a bug in MyFaces. That part
has been tested intensively. I think it is a bug in tomcat EL
implementation or maybe something related to openwebbeans
EL10ValueExpression.
regards,
Leonardo Uribe
2012/7/23 Rafael Pestano <[email protected]>:
> Hi Ludovic,
>
> i've had similar problem with closeListener of primefaces dialog inside
> composite components, my workaround was as follows:
>
>
> <composite:interface componentType="yourpackage.ModalComposite">
>
> <composite:attribute name="closeListener" method-signature="void
> method(org.primefaces.event.CloseEvent)" shortDescription="action to call on
> close - signature: void method(org.primefaces.event.CloseEvent)"/>
> ... other attributes...
>
> <composite:implementation
>
> <p:dialog header="#{cc.attrs.header}"
> //some attrs
> >
> <p:ajax event="close"
> listener="#{cc.closeListener}" //here is the important
> part
> update="#{cc.attrs.onCloseUpdate}"
> process="@this"/>
> //other stuff
>
>
> and finally the java class which handles the component
>
> @FacesComponent(value="yourpackage.ModalComposite")
> public class ModalComposite extends UINamingContainer {
>
> @Override
> public String getFamily() {
> return "javax.faces.NamingContainer"; // Important! Required for
> composite components.
> }
>
>
> public void closeListener(CloseEvent event) {
> FacesContext context = FacesContext.getCurrentInstance();
> MethodExpression ajaxEventListener = (MethodExpression)
> getAttributes().get("closeListener");
> if(ajaxEventListener != null){
> ajaxEventListener.invoke(context.getELContext(), new Object[] {
> event });
> }
> }
>
> and here is how to use it:
>
> <tag:modalComposite...
> closeListener="#{myBean.clearSelection}"
>
> public class MyBean {
>
> public void clearSelection(CloseEvent event){
> this.selectedPeople = null;
> }
> }
>
>
> maybe it helps as workaround for you..
>
>
> Att,
>
> Rafael M. Pestano
>
> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> Graduando em Ciência da Computação UFRGS
> http://conventionsframework.org
>
> http://rpestano.wordpress.com/
> @realpestano
>
>
> ________________________________
> De: "[email protected]" <[email protected]>
> Para: [email protected]
> Enviadas: Segunda-feira, 23 de Julho de 2012 14:53
> Assunto: Re: Passing method parameters to nested composite component
>
> On 23/07/2012 19:39, Leonardo Uribe wrote:
>> Hi
>>
>> Thinking more about it, check if both composite components define the
>> attribute with method-signature. In theory, if there is a bug, it
>> should be possible to reproduce it excluding primefaces and using
>> actionListener or valueChangeListener instead. But first try the
>> syntax using "targets" instead the cc EL expression.
> I immediatly tried "targets" when you pointed it (on both declarations). It
> did not help.
> Both composite components declare the attribute with "method-signature".
>
> The value is used by the inner control in an ajax declaration of a primefaces
> p:datatable :
>
> <p:ajax event="rowEdit" update="#{cc.attrs.onRowEdit}"
> listener="#{cc.attrs.onRowEditListener}" />
>
> I do not see how to use actionListener or valueChangeListener there.
>
> I tried (dirty) using cc.parent.attrs.onRowEditListener instead, and it did
> not help.
>
> h:outputText of cc.parent.attrs.onRowEditListener seems correct :
>
> org.apache.el.MethodExpressionImpl@358f0647
>
> Thx,
>
> Ludovic
>
> |
> | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
> |