Re: Re: Custom tag
to be aware of maybe naming convention of the clienBehavior name ? I tried this with an trivial example with nothing defined but clientBehavior and i cannot get this work. We need the callback parameter provided by primefaces ajax tag. Is that an myfaces issue or primefaces related ? Websphere 8.0.0.1 Myfaces 2.1.1 (i guess ) Primefaces 3.1 Send via Samsung Galaxy S2 Ursprüngliche Nachricht Betreff: Re: Custom tag Von: José Luis Cetina maxtorz...@gmail.com An: MyFaces Discussion users@myfaces.apache.org,Rafael Pestano rmpest...@yahoo.com.br CC: -- --- SCJA. José Luis Cetina --- -- --- SCJA. José Luis Cetina --- -- --- SCJA. José Luis Cetina ---
Re: Re: Custom tag
Hi For that case, in JSF 2.1 a new attribute for cc:attribute was added called targetAttributeName. For example: testComposite:compositeActionTargetAttributeName id=cc1 submitAction2=testActionMethodTypeSubmit cancelAction=#{bean.cancelAction} f:actionListener for=submitButton binding=#{bean.submitActionListener}/ f:actionListener for=cancelButton binding=#{bean.cancelActionListener}/ /testComposite:compositeActionTargetAttributeName testComposite:compositeActionTargetAttributeName.xhtml cc:interface cc:attribute name=submitAction2 targets=submitCancelButton targetAttributeName=submitAction method-signature=java.lang.Object action()/ cc:attribute name=cancelAction targets=submitCancelButton method-signature=java.lang.Object action()/ cc:actionSource name=submitButton targets=submitCancelButton/ cc:actionSource name=cancelButton targets=submitCancelButton/ /cc:interface cc:implementation testComposite:actionTargetAttributeName id=submitCancelButton/ /cc:implementation actionTargetAttributeName.xhtml cc:interface cc:attribute name=submitAction targets=submitButton targetAttributeName=action method-signature=java.lang.Object action()/ cc:attribute name=cancelAction targetAttributeName=action method-signature=java.lang.Object action()/ cc:actionSource name=submitButton/ cc:actionSource name=cancelButton targets=cancelAction/ /cc:interface cc:implementation h:commandButton id=submitButton value=Submit Button/ h:commandButton id=cancelAction value=Cancel Button/ /cc:implementation This is an example using two composite components from the test case. I think it is enough to put targetAttributeName=action, there is no need to add the method signature, I don't remember well, but I hope you get the idea. The problem described with clientBehavior sounds something different. Maybe one client behavior overrides the other one, but it doesn't sound like a bug. I don't know the details behind primefaces to say something about it, my first guess could be check if primefaces ajax is a real ClientBehavior, or its renderers do something under curtains, which is possible because after all, in that library you can add effects using component properties, and that's not possible without tweak p:ajax and the component renderers somehow. Note I'm speculating here. regards, Leonardo Uribe 2012/7/5 Thomas Herzog t.her...@curecomp.com: I do have a simular problem with clientBehavor and primefaces ajax tag. When a clientBehavor is defined in the composite component and in the view the composite component is used with primefaces ajax then the clientBehavior is not added to the component but will added with faclet ajax. Did anyone face this ? Is there anything to be aware of maybe naming convention of the clienBehavior name ? I tried this with an trivial example with nothing defined but clientBehavior and i cannot get this work. We need the callback parameter provided by primefaces ajax tag. Is that an myfaces issue or primefaces related ? Websphere 8.0.0.1 Myfaces 2.1.1 (i guess ) Primefaces 3.1 Send via Samsung Galaxy S2 Ursprüngliche Nachricht Betreff: Re: Custom tag Von: José Luis Cetina maxtorz...@gmail.com An: MyFaces Discussion users@myfaces.apache.org,Rafael Pestano rmpest...@yahoo.com.br CC:
Re: Re: Custom tag
I saw you example before, but i get confused when i try yo use the targetAttributeName, in my xhtml says: The attribute targetAttributeName is not defined in the component attribute Im using MyFaces 2.1.8 with TomEE 1.0.0 (trunk updated version). Why targetAttributeName is not defined? what im doing wrong? 2012/7/6 Leonardo Uribe lu4...@gmail.com: Hi For that case, in JSF 2.1 a new attribute for cc:attribute was added called targetAttributeName. For example: testComposite:compositeActionTargetAttributeName id=cc1 submitAction2=testActionMethodTypeSubmit cancelAction=#{bean.cancelAction} f:actionListener for=submitButton binding=#{bean.submitActionListener}/ f:actionListener for=cancelButton binding=#{bean.cancelActionListener}/ /testComposite:compositeActionTargetAttributeName testComposite:compositeActionTargetAttributeName.xhtml cc:interface cc:attribute name=submitAction2 targets=submitCancelButton targetAttributeName=submitAction method-signature=java.lang.Object action()/ cc:attribute name=cancelAction targets=submitCancelButton method-signature=java.lang.Object action()/ cc:actionSource name=submitButton targets=submitCancelButton/ cc:actionSource name=cancelButton targets=submitCancelButton/ /cc:interface cc:implementation testComposite:actionTargetAttributeName id=submitCancelButton/ /cc:implementation actionTargetAttributeName.xhtml cc:interface cc:attribute name=submitAction targets=submitButton targetAttributeName=action method-signature=java.lang.Object action()/ cc:attribute name=cancelAction targetAttributeName=action method-signature=java.lang.Object action()/ cc:actionSource name=submitButton/ cc:actionSource name=cancelButton targets=cancelAction/ /cc:interface cc:implementation h:commandButton id=submitButton value=Submit Button/ h:commandButton id=cancelAction value=Cancel Button/ /cc:implementation This is an example using two composite components from the test case. I think it is enough to put targetAttributeName=action, there is no need to add the method signature, I don't remember well, but I hope you get the idea. The problem described with clientBehavior sounds something different. Maybe one client behavior overrides the other one, but it doesn't sound like a bug. I don't know the details behind primefaces to say something about it, my first guess could be check if primefaces ajax is a real ClientBehavior, or its renderers do something under curtains, which is possible because after all, in that library you can add effects using component properties, and that's not possible without tweak p:ajax and the component renderers somehow. Note I'm speculating here. regards, Leonardo Uribe 2012/7/5 Thomas Herzog t.her...@curecomp.com: I do have a simular problem with clientBehavor and primefaces ajax tag. When a clientBehavor is defined in the composite component and in the view the composite component is used with primefaces ajax then the clientBehavior is not added to the component but will added with faclet ajax. Did anyone face this ? Is there anything to be aware of maybe naming convention of the clienBehavior name ? I tried this with an trivial example with nothing defined but clientBehavior and i cannot get this work. We need the callback parameter provided by primefaces ajax tag. Is that an myfaces issue or primefaces related ? Websphere 8.0.0.1 Myfaces 2.1.1 (i guess ) Primefaces 3.1 Send via Samsung Galaxy S2 Ursprüngliche Nachricht Betreff: Re: Custom tag Von: José Luis Cetina maxtorz...@gmail.com An: MyFaces Discussion users@myfaces.apache.org,Rafael Pestano rmpest...@yahoo.com.br CC: -- --- SCJA. José Luis Cetina ---
Re: Re: Custom tag
Here is what i have: html xmlns=http://www.w3.org/1999/xhtml; xmlns:h=http://java.sun.com/jsf/html; xmlns:f=http://java.sun.com/jsf/core; xmlns:p=http://primefaces.org/ui; xmlns:kx=http://java.sun.com/jsf/composite/componentes; xmlns:cc=http://java.sun.com/jsf/composite; !-- INTERFACE -- cc:interface componentType=myComponentExample cc:targetAttributeName/ /cc:interface .. I see this: The component library Composite Components does not contain component targetAttributeName As i can see i dont have the targetAttributeName and clientBehaviour attributes, why? pom.xml: dependency groupIdorg.apache.myfaces.core/groupId artifactIdmyfaces-bundle/artifactId version2.1.8/version scopeprovided/scope /dependency Using Netbeans 7.1 2012/7/6 José Luis Cetina maxtorz...@gmail.com: I saw you example before, but i get confused when i try yo use the targetAttributeName, in my xhtml says: The attribute targetAttributeName is not defined in the component attribute Im using MyFaces 2.1.8 with TomEE 1.0.0 (trunk updated version). Why targetAttributeName is not defined? what im doing wrong? 2012/7/6 Leonardo Uribe lu4...@gmail.com: Hi For that case, in JSF 2.1 a new attribute for cc:attribute was added called targetAttributeName. For example: testComposite:compositeActionTargetAttributeName id=cc1 submitAction2=testActionMethodTypeSubmit cancelAction=#{bean.cancelAction} f:actionListener for=submitButton binding=#{bean.submitActionListener}/ f:actionListener for=cancelButton binding=#{bean.cancelActionListener}/ /testComposite:compositeActionTargetAttributeName testComposite:compositeActionTargetAttributeName.xhtml cc:interface cc:attribute name=submitAction2 targets=submitCancelButton targetAttributeName=submitAction method-signature=java.lang.Object action()/ cc:attribute name=cancelAction targets=submitCancelButton method-signature=java.lang.Object action()/ cc:actionSource name=submitButton targets=submitCancelButton/ cc:actionSource name=cancelButton targets=submitCancelButton/ /cc:interface cc:implementation testComposite:actionTargetAttributeName id=submitCancelButton/ /cc:implementation actionTargetAttributeName.xhtml cc:interface cc:attribute name=submitAction targets=submitButton targetAttributeName=action method-signature=java.lang.Object action()/ cc:attribute name=cancelAction targetAttributeName=action method-signature=java.lang.Object action()/ cc:actionSource name=submitButton/ cc:actionSource name=cancelButton targets=cancelAction/ /cc:interface cc:implementation h:commandButton id=submitButton value=Submit Button/ h:commandButton id=cancelAction value=Cancel Button/ /cc:implementation This is an example using two composite components from the test case. I think it is enough to put targetAttributeName=action, there is no need to add the method signature, I don't remember well, but I hope you get the idea. The problem described with clientBehavior sounds something different. Maybe one client behavior overrides the other one, but it doesn't sound like a bug. I don't know the details behind primefaces to say something about it, my first guess could be check if primefaces ajax is a real ClientBehavior, or its renderers do something under curtains, which is possible because after all, in that library you can add effects using component properties, and that's not possible without tweak p:ajax and the component renderers somehow. Note I'm speculating here. regards, Leonardo Uribe 2012/7/5 Thomas Herzog t.her...@curecomp.com: I do have a simular problem with clientBehavor and primefaces ajax tag. When a clientBehavor is defined in the composite component and in the view the composite component is used with primefaces ajax then the clientBehavior is not added to the component but will added with faclet ajax. Did anyone face this ? Is there anything to be aware of maybe naming convention of the clienBehavior name ? I tried this with an trivial example with nothing defined but clientBehavior and i cannot get this work. We need the callback parameter provided by primefaces ajax tag. Is that an myfaces issue or primefaces related ? Websphere 8.0.0.1 Myfaces 2.1.1 (i guess ) Primefaces 3.1 Send via Samsung Galaxy S2 Ursprüngliche Nachricht Betreff: Re: Custom tag Von: José Luis Cetina maxtorz...@gmail.com An: MyFaces Discussion users@myfaces.apache.org,Rafael Pestano rmpest...@yahoo.com.br CC: -- --- SCJA. José Luis Cetina --- -- --- SCJA. José Luis Cetina ---
Re: Custom tag
Hi leonardo, this example works: You can try the alternate syntax using targets. For example: composite:interface composite:attribute name=action targets=testComponent/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ /composite:implementation but what about whit this: composite:interface composite:attribute name=action targets=testComponent/ composite:attribute name=action2 targets=testComponent2/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ h:commandButton id=testComponent2 value=Press Me 2/ /composite:implementation Im triying to use the the action attribute mycomp:test action=#{bean.myaction} action2=#{bean.myaction2} /mycomp:test this doesnt work (myaction2 never been invoke) i guess because the name of attribute is action2 an not action, but i already use action attribute for my first button, how can i resolve this? I want to have 2 buttons in my composite component, then my 2 buttons can have action method (using the attributes). Thanks 2012/6/29 Rafael Pestano rmpest...@yahoo.com.br: you're welcome. Leonardo's approach is the solution, what i proposed was more like a workaround ;) 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Sexta-feira, 29 de Junho de 2012 12:02 Assunto: Re: Custom tag Thanks Rafael and Leonardo. Its very easy with target, this solution is best in my opinion. Works. Thanks again 2012/6/29 Leonardo Uribe lu4...@gmail.com: Hi You can try the alternate syntax using targets. For example: composite:interface composite:attribute name=action targets=testComponent/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ /composite:implementation Instead use EL, you can use the id hierarchy to locate the component. In this case, there will not be NullPointerException, because only if the property is set, the value is assigned. I have tested both syntax in MyFaces with tons of tests: http://svn.apache.org/repos/asf/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/ and it works without problem. regards, Leonardo Uribe 2012/6/29 Rafael Pestano rmpest...@yahoo.com.br: again, cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / /cc:implementation 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano - Mensagem original - De: Rafael Pestano rmpest...@yahoo.com.br Para: MyFaces Discussion users@myfaces.apache.org Cc: Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 Assunto: Re: Custom tag you can try: cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation maybe it helps. 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 Assunto: Custom tag Hi i have this: Simple custom tag: cc: interface componentType=my_button cc:attribute name=action method-signature
WG: Re: Custom tag
I do have a simular problem with clientBehavor and primefaces ajax tag. When a clientBehavor is defined in the composite component and in the view the composite component is used with primefaces ajax then the clientBehavior is not added to the component but will added with faclet ajax. Did anyone face this ? Is there anything to be aware of maybe naming convention of the clienBehavior name ? I tried this with an trivial example with nothing defined but clientBehavior and i cannot get this work. We need the callback parameter provided by primefaces ajax tag. Is that an myfaces issue or primefaces related ? Websphere 8.0.0.1 Myfaces 2.1.1 (i guess ) Primefaces 3.1 Send via Samsung Galaxy S2 Ursprüngliche Nachricht Betreff: Re: Custom tag Von: José Luis Cetina maxtorz...@gmail.com An: MyFaces Discussion users@myfaces.apache.org,Rafael Pestano rmpest...@yahoo.com.br CC: ---BeginMessage--- Hi leonardo, this example works: You can try the alternate syntax using targets. For example: composite:interface composite:attribute name=action targets=testComponent/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ /composite:implementation but what about whit this: composite:interface composite:attribute name=action targets=testComponent/ composite:attribute name=action2 targets=testComponent2/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ h:commandButton id=testComponent2 value=Press Me 2/ /composite:implementation Im triying to use the the action attribute mycomp:test action=#{bean.myaction} action2=#{bean.myaction2} /mycomp:test this doesnt work (myaction2 never been invoke) i guess because the name of attribute is action2 an not action, but i already use action attribute for my first button, how can i resolve this? I want to have 2 buttons in my composite component, then my 2 buttons can have action method (using the attributes). Thanks 2012/6/29 Rafael Pestano rmpest...@yahoo.com.br: you're welcome. Leonardo's approach is the solution, what i proposed was more like a workaround ;) 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Sexta-feira, 29 de Junho de 2012 12:02 Assunto: Re: Custom tag Thanks Rafael and Leonardo. Its very easy with target, this solution is best in my opinion. Works. Thanks again 2012/6/29 Leonardo Uribe lu4...@gmail.com: Hi You can try the alternate syntax using targets. For example: composite:interface composite:attribute name=action targets=testComponent/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ /composite:implementation Instead use EL, you can use the id hierarchy to locate the component. In this case, there will not be NullPointerException, because only if the property is set, the value is assigned. I have tested both syntax in MyFaces with tons of tests: http://svn.apache.org/repos/asf/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/ and it works without problem. regards, Leonardo Uribe 2012/6/29 Rafael Pestano rmpest...@yahoo.com.br: again, cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / /cc:implementation 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano - Mensagem original - De: Rafael Pestano rmpest...@yahoo.com.br Para: MyFaces Discussion users@myfaces.apache.org Cc: Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 Assunto: Re: Custom tag you can try: cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty
Re: Custom tag
Hi You can try the alternate syntax using targets. For example: composite:interface composite:attribute name=action targets=testComponent/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ /composite:implementation Instead use EL, you can use the id hierarchy to locate the component. In this case, there will not be NullPointerException, because only if the property is set, the value is assigned. I have tested both syntax in MyFaces with tons of tests: http://svn.apache.org/repos/asf/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/ and it works without problem. regards, Leonardo Uribe 2012/6/29 Rafael Pestano rmpest...@yahoo.com.br: again, cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / /cc:implementation 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano - Mensagem original - De: Rafael Pestano rmpest...@yahoo.com.br Para: MyFaces Discussion users@myfaces.apache.org Cc: Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 Assunto: Re: Custom tag you can try: cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation maybe it helps. 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 Assunto: Custom tag Hi i have this: Simple custom tag: cc: interface componentType=my_button cc:attribute name=action method-signature=java.lang.String action()/ cc:attribute name=actionListener method-signature=void actionListener(javax.faces.event.ActionEvent event)/ / cc:interface cc:implementation h:commandButton value=Ok action=#{cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation Then in my page i do: mytags:mybutton action=#{myBean.actionMethod}/ But i get a NullPointerException, this is because im not setting the actionListener attribute, but the thing is that sometimes i need or only action or actionlistener not both, but i have to provided both if not i get the nullpointer. I have to do this, but the listener method is empty in my managedbean, i only do this for avoid the nullpointer. mytags:mybutton action=#{myBean.actionMethod} actionListener=#{myBean.actionListenerMethod}/ how can i avoid this? Thanks --- SCJA. José Luis Cetina ---
Re: Custom tag
Thanks Rafael and Leonardo. Its very easy with target, this solution is best in my opinion. Works. Thanks again 2012/6/29 Leonardo Uribe lu4...@gmail.com: Hi You can try the alternate syntax using targets. For example: composite:interface composite:attribute name=action targets=testComponent/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ /composite:implementation Instead use EL, you can use the id hierarchy to locate the component. In this case, there will not be NullPointerException, because only if the property is set, the value is assigned. I have tested both syntax in MyFaces with tons of tests: http://svn.apache.org/repos/asf/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/ and it works without problem. regards, Leonardo Uribe 2012/6/29 Rafael Pestano rmpest...@yahoo.com.br: again, cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / /cc:implementation 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano - Mensagem original - De: Rafael Pestano rmpest...@yahoo.com.br Para: MyFaces Discussion users@myfaces.apache.org Cc: Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 Assunto: Re: Custom tag you can try: cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation maybe it helps. 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 Assunto: Custom tag Hi i have this: Simple custom tag: cc: interface componentType=my_button cc:attribute name=action method-signature=java.lang.String action()/ cc:attribute name=actionListener method-signature=void actionListener(javax.faces.event.ActionEvent event)/ / cc:interface cc:implementation h:commandButton value=Ok action=#{cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation Then in my page i do: mytags:mybutton action=#{myBean.actionMethod}/ But i get a NullPointerException, this is because im not setting the actionListener attribute, but the thing is that sometimes i need or only action or actionlistener not both, but i have to provided both if not i get the nullpointer. I have to do this, but the listener method is empty in my managedbean, i only do this for avoid the nullpointer. mytags:mybutton action=#{myBean.actionMethod} actionListener=#{myBean.actionListenerMethod}/ how can i avoid this? Thanks --- SCJA. José Luis Cetina --- -- --- SCJA. José Luis Cetina ---
Re: Custom tag
you're welcome. Leonardo's approach is the solution, what i proposed was more like a workaround ;) 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Sexta-feira, 29 de Junho de 2012 12:02 Assunto: Re: Custom tag Thanks Rafael and Leonardo. Its very easy with target, this solution is best in my opinion. Works. Thanks again 2012/6/29 Leonardo Uribe lu4...@gmail.com: Hi You can try the alternate syntax using targets. For example: composite:interface composite:attribute name=action targets=testComponent/ /composite:interface composite:implementation h:commandButton id=testComponent value=Press Me/ /composite:implementation Instead use EL, you can use the id hierarchy to locate the component. In this case, there will not be NullPointerException, because only if the property is set, the value is assigned. I have tested both syntax in MyFaces with tons of tests: http://svn.apache.org/repos/asf/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/ and it works without problem. regards, Leonardo Uribe 2012/6/29 Rafael Pestano rmpest...@yahoo.com.br: again, cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / /cc:implementation 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano - Mensagem original - De: Rafael Pestano rmpest...@yahoo.com.br Para: MyFaces Discussion users@myfaces.apache.org Cc: Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 Assunto: Re: Custom tag you can try: cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation maybe it helps. 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 Assunto: Custom tag Hi i have this: Simple custom tag: cc: interface componentType=my_button cc:attribute name=action method-signature=java.lang.String action()/ cc:attribute name=actionListener method-signature=void actionListener(javax.faces.event.ActionEvent event)/ / cc:interface cc:implementation h:commandButton value=Ok action=#{cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation Then in my page i do: mytags:mybutton action=#{myBean.actionMethod}/ But i get a NullPointerException, this is because im not setting the actionListener attribute, but the thing is that sometimes i need or only action or actionlistener not both, but i have to provided both if not i get the nullpointer. I have to do this, but the listener method is empty in my managedbean, i only do this for avoid the nullpointer. mytags:mybutton action=#{myBean.actionMethod} actionListener=#{myBean.actionListenerMethod}/ how can i avoid this? Thanks --- SCJA. José Luis Cetina --- -- --- SCJA. José
Re: Custom tag
you can try: cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation maybe it helps. 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 Assunto: Custom tag Hi i have this: Simple custom tag: cc: interface componentType=my_button cc:attribute name=action method-signature=java.lang.String action()/ cc:attribute name=actionListener method-signature=void actionListener(javax.faces.event.ActionEvent event)/ / cc:interface cc:implementation h:commandButton value=Ok action=#{cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation Then in my page i do: mytags:mybutton action=#{myBean.actionMethod}/ But i get a NullPointerException, this is because im not setting the actionListener attribute, but the thing is that sometimes i need or only action or actionlistener not both, but i have to provided both if not i get the nullpointer. I have to do this, but the listener method is empty in my managedbean, i only do this for avoid the nullpointer. mytags:mybutton action=#{myBean.actionMethod} actionListener=#{myBean.actionListenerMethod}/ how can i avoid this? Thanks --- SCJA. José Luis Cetina ---
Re: Custom tag
again, cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / /cc:implementation 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano - Mensagem original - De: Rafael Pestano rmpest...@yahoo.com.br Para: MyFaces Discussion users@myfaces.apache.org Cc: Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 Assunto: Re: Custom tag you can try: cc:implementation h:commandButton value=Ok rendered=#{not empty cc.attrs.action and empty cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} action=#{cc.attrs.action} / h:commandButton value=Ok rendered=#{not empty cc.attrs.actionListener and not empty cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation maybe it helps. 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://code.google.com/p/jsf-conventions-framework/ http://rpestano.wordpress.com http://twitter.com/realpestano De: José Luis Cetina maxtorz...@gmail.com Para: MyFaces Discussion users@myfaces.apache.org Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 Assunto: Custom tag Hi i have this: Simple custom tag: cc: interface componentType=my_button cc:attribute name=action method-signature=java.lang.String action()/ cc:attribute name=actionListener method-signature=void actionListener(javax.faces.event.ActionEvent event)/ / cc:interface cc:implementation h:commandButton value=Ok action=#{cc.attrs.action} actionListener=#{cc.attrs.actionListener} / /cc:implementation Then in my page i do: mytags:mybutton action=#{myBean.actionMethod}/ But i get a NullPointerException, this is because im not setting the actionListener attribute, but the thing is that sometimes i need or only action or actionlistener not both, but i have to provided both if not i get the nullpointer. I have to do this, but the listener method is empty in my managedbean, i only do this for avoid the nullpointer. mytags:mybutton action=#{myBean.actionMethod} actionListener=#{myBean.actionListenerMethod}/ how can i avoid this? Thanks --- SCJA. José Luis Cetina ---