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é
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
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 ---
Re: [Tobago] Using validator in custom tag
Hi, there's no '{' in #validator.validate}); Regards Helmut Am 30.03.2010 18:53, schrieb Alf Felis: Hi all, I try to use a validator dependent on a property within a custom tag class. My class extends TagSupport and overwrites the doStartTag() method. In this method I add a validator depending on a property (see below). First the property is false and no validator will be added to the inExtensionTag. Now (next access to the page) the property will change to true and the output Setting validator! shows me, that the validator has been set. But the validator will never be called! If I always add the validator (not depending on the property), everything works fine. The validator will be called on submit. What is wrong with my approach? Is there another possibility to do what I want? Example: @Override public int doStartTag() throws JspException { InExtensionTag inExtensionTag = new InExtensionTag(); inExtensionTag.setPageContext(pageContext); inExtensionTag.setParent(getParent()); inExtensionTag.setId(id); inExtensionTag.setLabel(label); inExtensionTag.setValue(value); if (isValidationEnabled()) { System.out.println(Setting validator!); inExtensionTag.setValidator(#validator.validate}); } inExtensionTag.doStartTag(); inExtensionTag.doEndTag(); return super.doStartTag(); } Best regards, Alf
Re: [Tobago] Using validator in custom tag
yes it should be like.. inExtensionTag.setValidator(#*{*validator.validate*}*); Thanks, Vinod On Wed, Mar 31, 2010 at 12:55 PM, Helmut Swaczinna myfa...@wlp-systems.dewrote: Hi, there's no '{' in #validator.validate}); Regards Helmut Am 30.03.2010 18:53, schrieb Alf Felis: Hi all, I try to use a validator dependent on a property within a custom tag class. My class extends TagSupport and overwrites the doStartTag() method. In this method I add a validator depending on a property (see below). First the property is false and no validator will be added to the inExtensionTag. Now (next access to the page) the property will change to true and the output Setting validator! shows me, that the validator has been set. But the validator will never be called! If I always add the validator (not depending on the property), everything works fine. The validator will be called on submit. What is wrong with my approach? Is there another possibility to do what I want? Example: @Override public int doStartTag() throws JspException { InExtensionTag inExtensionTag = new InExtensionTag(); inExtensionTag.setPageContext(pageContext); inExtensionTag.setParent(getParent()); inExtensionTag.setId(id); inExtensionTag.setLabel(label); inExtensionTag.setValue(value); if (isValidationEnabled()) { System.out.println(Setting validator!); inExtensionTag.setValidator(#validator.validate}); } inExtensionTag.doStartTag(); inExtensionTag.doEndTag(); return super.doStartTag(); } Best regards, Alf
Re: [Tobago] Using validator in custom tag
Yes... you are right... that was a typing error... but only in the email ;) The original code has a '{' before the validator. But my problem still exist... Any idea? Regards, Alf -Ursprüngliche Nachricht- Von: Now I find myself in question vin.si...@gmail.com Gesendet: 31.03.2010 09:44:03 An: MyFaces Discussion users@myfaces.apache.org Betreff: Re: [Tobago] Using validator in custom tag yes it should be like.. inExtensionTag.setValidator(#*{*validator.validate*}*); Thanks, Vinod On Wed, Mar 31, 2010 at 12:55 PM, Helmut Swaczinna myfa...@wlp-systems.dewrote: Hi, there's no '{' in #validator.validate}); Regards Helmut Am 30.03.2010 18:53, schrieb Alf Felis: Hi all, I try to use a validator dependent on a property within a custom tag class. My class extends TagSupport and overwrites the doStartTag() method. In this method I add a validator depending on a property (see below). First the property is false and no validator will be added to the inExtensionTag. Now (next access to the page) the property will change to true and the output Setting validator! shows me, that the validator has been set. But the validator will never be called! If I always add the validator (not depending on the property), everything works fine. The validator will be called on submit. What is wrong with my approach? Is there another possibility to do what I want? Example: @Override public int doStartTag() throws JspException { InExtensionTag inExtensionTag = new InExtensionTag(); inExtensionTag.setPageContext(pageContext); inExtensionTag.setParent(getParent()); inExtensionTag.setId(id); inExtensionTag.setLabel(label); inExtensionTag.setValue(value); if (isValidationEnabled()) { System.out.println(Setting validator!); inExtensionTag.setValidator(#validator.validate}); } inExtensionTag.doStartTag(); inExtensionTag.doEndTag(); return super.doStartTag(); } Best regards, Alf -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
Re: [Tobago] Using validator in custom tag
Hi all, I found a problem with the page reloading. It seems that the page didn't relaod correctly. Now it works :) However... many thanks for your help. Regards, Alf -- GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02
[Tobago] Using validator in custom tag
Hi all, I try to use a validator dependent on a property within a custom tag class. My class extends TagSupport and overwrites the doStartTag() method. In this method I add a validator depending on a property (see below). First the property is false and no validator will be added to the inExtensionTag. Now (next access to the page) the property will change to true and the output Setting validator! shows me, that the validator has been set. But the validator will never be called! If I always add the validator (not depending on the property), everything works fine. The validator will be called on submit. What is wrong with my approach? Is there another possibility to do what I want? Example: @Override public int doStartTag() throws JspException { InExtensionTag inExtensionTag = new InExtensionTag(); inExtensionTag.setPageContext(pageContext); inExtensionTag.setParent(getParent()); inExtensionTag.setId(id); inExtensionTag.setLabel(label); inExtensionTag.setValue(value); if (isValidationEnabled()) { System.out.println(Setting validator!); inExtensionTag.setValidator(#validator.validate}); } inExtensionTag.doStartTag(); inExtensionTag.doEndTag(); return super.doStartTag(); } Best regards, Alf -- GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02
Re: binding property in my custom tag is not working
Try removing anything related to binding in your custom tag, since it extends HtmlPanelGridTag which eventually extends UIComponentTag, binding property should be taken caren of in super class. On Nov 23, 2007 9:04 AM, Rajeshekar S [EMAIL PROTECTED] wrote: Hi , I want to create a custom tag with binding attribute.In the customTagClass i put property binding . The Tag class is: public class CustomPanelGridTag extends HtmlPanelGridTag{ private String paginator; private String binding; public void setBinding(String binding) { this.binding = binding; } public void setPaginator(String paginator) { this.paginator = paginator; } public String getComponentType() { return CustomPanelGrid.COMPONENT_TYPE; } public String getRendererType() { return javax.faces.Grid; } protected void setProperties(UIComponent component) { super.setProperties(component); setString(component,paginator,paginator); // I tried by putting setString(component,binding,binding) } public void release() { super.release(); } public void setString(UIComponent component, String attributeName, String attributeValue) { if (attributeValue == null) { return; } if (isValueReference(attributeValue)) { System.out.println(attributeName+attributeValue); setValueBinding(component, attributeName, attributeValue); } else { System.out.println(attributeNameattr+attributeValue); component.getAttributes().put(attributeName, attributeValue); } } /** * sets the value binding of an atttibute * @param component * @param attributeName * @param attributeValue */ public void setValueBinding(UIComponent component, String attributeName, String attributeValue) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); ValueBinding vb = app.createValueBinding(attributeValue); component.setValueBinding(attributeName, vb); } } Component binding is not working with this binding property. I even tried putting try { super.setBinding(binding); } catch (JspException e) { // TODO Auto-generated catch block e.printStackTrace(); } in set Properties method of this tag,then also component instance binding is not done. Please let me help in knowing what to do if we want to have a binding property in the custom tag.It will be great help if any body tell how the binding propery works done in JSF.To my knowledge , _jspService method calls the UIComponentTag.setBinding... and after that UIComponentTag.createComponentInstance is called to create the component with the instance given by binding property. Thanks, Rajeshekar
binding property in my custom tag is not working
Hi , I want to create a custom tag with binding attribute.In the customTagClass i put property binding . The Tag class is: public class CustomPanelGridTag extends HtmlPanelGridTag{ private String paginator; private String binding; public void setBinding(String binding) { this.binding = binding; } public void setPaginator(String paginator) { this.paginator = paginator; } public String getComponentType() { return CustomPanelGrid.COMPONENT_TYPE; } public String getRendererType() { return javax.faces.Grid; } protected void setProperties(UIComponent component) { super.setProperties(component); setString(component,paginator,paginator); // I tried by putting setString(component,binding,binding) } public void release() { super.release(); } public void setString(UIComponent component, String attributeName, String attributeValue) { if (attributeValue == null) { return; } if (isValueReference(attributeValue)) { System.out.println(attributeName+attributeValue); setValueBinding(component, attributeName, attributeValue); } else { System.out.println(attributeNameattr+attributeValue); component.getAttributes().put(attributeName, attributeValue); } } /** * sets the value binding of an atttibute * @param component * @param attributeName * @param attributeValue */ public void setValueBinding(UIComponent component, String attributeName, String attributeValue) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); ValueBinding vb = app.createValueBinding(attributeValue); component.setValueBinding(attributeName, vb); } } Component binding is not working with this binding property. I even tried putting try { super.setBinding(binding); } catch (JspException e) { // TODO Auto-generated catch block e.printStackTrace(); } in set Properties method of this tag,then also component instance binding is not done. Please let me help in knowing what to do if we want to have a binding property in the custom tag.It will be great help if any body tell how the binding propery works done in JSF.To my knowledge , _jspService method calls the UIComponentTag.setBinding... and after that UIComponentTag.createComponentInstance is called to create the component with the instance given by binding property. Thanks, Rajeshekar
Re: Help with included jsp file Illegal to flush within a custom tag
Myfaces api 1.1.4 and impl 1.1.3 are incompatible. You must use the same version for both api and impl at all times. This is possibly the cause of your problem. Use of tomahawk 1.1.3 with Myfaces core (api+impl) 1.1.4 should work. On 1/19/07, Todd Nine [EMAIL PROTECTED] wrote: Hi all, I am constantly receiving this error message. and I can't figure it out. My parent page is index.jsp, my jsp include page is include/header.jsp. My index.jsp is as follows. %@ taglib uri= http://java.sun.com/jsf/html; prefix=h% %@ taglib uri=http://java.sun.com/jsf/core; prefix=f% ..other stuff .. f:view table width=775 border=0 align=center cellpadding=0 cellspacing=0 class=container tr td colspan=2 div class=header !-- Start of the Search Form -- f:subview id=search jsp:include page=include/header.jsp flush=false/ /f:subview ..other stuff... /f:view Here is my header.jsp %@ taglib uri= http://java.sun.com/jsf/html; prefix=h% %@ taglib uri=http://java.sun.com/jsf/core; prefix=f% div class=complogoa href=index.jsfimg src=images/comp_logo.jpg width=173 height=115 border=0/a/div script type=text/javascript !-- function clearForm(textField) { textField.value = ; } //-- /script f:view h:form id=Form1 f:verbatim div class=searcher p class=qlinxa href=index.jsfHome/a/p /f:verbatim h:inputText value=#{searchBean.searchTerms} styleClass=searchInput onclick=clearForm(this); onfocus=clearForm(this);/h:inputText h:commandButton action=#{searchBean.performSearch} styleClass=go_btn style=align:right; image=images/btn_go.jpg/h:commandButton f:verbatim /div /f:verbatim /h:form /f:view I have tried the attribute flush=false on the JSP include, and I still receive this error. I'm using myface-api 1.1.4, myfaces-impl 1.1.3 and tomahawk 1.1.3. Thanks, Todd
Help with included jsp file Illegal to flush within a custom tag
Hi all, I am constantly receiving this error message. and I can't figure it out. My parent page is index.jsp, my jsp include page is include/header.jsp. My index.jsp is as follows. %@ taglib uri=http://java.sun.com/jsf/html; prefix=h% %@ taglib uri=http://java.sun.com/jsf/core; prefix=f% ..other stuff .. f:view table width=775 border=0 align=center cellpadding=0 cellspacing=0 class=container tr td colspan=2 div class=header !-- Start of the Search Form -- f:subview id=search jsp:include page=include/header.jsp flush=false/ /f:subview ..other stuff... /f:view Here is my header.jsp %@ taglib uri=http://java.sun.com/jsf/html; prefix=h% %@ taglib uri=http://java.sun.com/jsf/core; prefix=f% div class=complogoa href=index.jsfimg src=images/comp_logo.jpg width=173 height=115 border=0/a/div script type=text/javascript !-- function clearForm(textField) { textField.value = ; } //-- /script f:view h:form id=Form1 f:verbatim div class=searcher p class=qlinxa href=index.jsfHome/a/p /f:verbatim h:inputText value=#{searchBean.searchTerms} styleClass=searchInput onclick=clearForm(this); onfocus=clearForm(this);/h:inputText h:commandButton action=#{searchBean.performSearch} styleClass=go_btn style=align:right; image=images/btn_go.jpg/h:commandButton f:verbatim /div /f:verbatim /h:form /f:view I have tried the attribute flush=false on the JSP include, and I still receive this error. I'm using myface-api 1.1.4, myfaces-impl 1.1.3 and tomahawk 1.1.3. Thanks, Todd
Re: [newbie] - simple custom tag problems
Hi Volker, Thanks for your response! I attempted the forcing of the ValueBinding in the setProperties() since setting value of the tag attribute was not passed on to the Component Class. In a case like this: my:testTag value=My message (or) my:testTag value=#{datapanel.description} where description is a String, the contents of the 'value' attribute in the setProperty method of the Tag class are picked up ok. But in the case when the the Bean member is not a string (like in the dataTable case), the contents of the value attribute in setProperty() are : #{datapanel.description}. In this case, the getValue() in my Custom Component class is null and the EL does not seem to be processed. My setProperties() method : protected void setProperties(UIComponent component) { FacesContext context = FacesContext.getCurrentInstance(); super.setProperties(component); if(value != null) { if (isValueReference(value)) { ValueBinding vb = context.getApplication().createValueBinding(value); component.setValueBinding(value, vb); } else ((UICustomHTMLOutput)component).setValue(value); } } And my state and encode methods from the UICustomHTMLOutput: @Override public Object saveState(FacesContext context) { Object values[] = new Object[2]; values[0] = super.saveState(context); values[1] = value; return ((Object) (values)); } @Override public void restoreState(FacesContext context, Object state) { Object values[] = (Object[])state; super.restoreState(context, values[0]); value = (String)values[1]; } // component render public void encodeBegin(FacesContext context) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement(p, this); writer.write(value); writer.endElement(p); writer.flush(); } Any help is greatly appreciated. Thanks! -Rajiv On 11/05/06, Volker Weber [EMAIL PROTECTED] wrote: Hi Rajiv,JSFSter Smith wrote: Firstly, kudos to the MyFaces team for the recent releases of myfaces 1.1.3 and tomahawk 1.1.2! I am just a few weeks old with JSF and am using it for a current project. So far its been great but I am still getting to know the deatils. I attempted to create a simple custom JSP tag and was able to get it together surprisingly quickly. But I do have a problem now. My tag essentially renders the string in an attribute value. Here is a sample usage: my:testTag value=My message (or) my:testTag value=#{datapanel.description } But the ValueBinding does not seem to work when I try to access a member of the DataPanel bean that is a collection or another class that has members. Examples of these cases are below: t:dataTable value=#{datapanel.sentenceDisplayData} var=each t:column my:testTag value=#{each.part0} / my:testTag value=#{ each.part1} / my:testTag value=#{each.part2} / my:testTag value=#{each.part3} / /t:column /t:dataTable (OR) my:testTag value=#{datapanel.summary.length I am including my setProperties method of the TagLib class. Would be great if someone can point out what I am missing here. protected void setProperties(UIComponent component) { /* you have to call the super class */ FacesContext context = FacesContext.getCurrentInstance(); super.setProperties(component); if(value != null) { if (isValueReference(value)){ ValueBinding vb = context.getApplication().createValueBinding(value); component.setValueBinding(value, vb);- remove following -- // forcing the value from the ValueBinding to the component. if(vb != null) { if(vb.getValue(context) != null) ((UIInfactHTMLOutput)component).setValue(vb.getValue(context).toString()); }- / remove following --Why this? Thats the problem! Here are the valueBinding evaluated at component creation time, butdatatable needs eavluation at rendering time!just remove this an it should do. } else ((UIInfactHTMLOutput)component).setValue(value); } }or better implement your set properties using UIComponentTagUtils like this:protected void setProperties(UIComponent component) {super.setProperties(component);UIComponentTagUtils.setValueProperty(getFacesContext(), component,value);}Regards,Volker thanks in advance! -Rajiv--Don't answer to From: address!Mail to this account are droped if not recieved via mailinglist.To contact me direct create the mail address byconcatenating my forename to my senders domain.
Re: [newbie] - simple custom tag problems
Hi, see inline JSFSter Smith wrote: Hi Volker, Thanks for your response! I attempted the forcing of the ValueBinding in the setProperties() since setting value of the tag attribute was not passed on to the Component Class. In a case like this: my:testTag value=My message (or) my:testTag value=#{datapanel.description} where description is a String, the contents of the 'value' attribute in the setProperty method of the Tag class are picked up ok. But in the case when the the Bean member is not a string (like in the dataTable case), the contents of the value attribute in setProperty() are : #{datapanel.description}. In this case, the getValue() in my Custom Component class is null and the EL does not seem to be processed. My setProperties() method : protected void setProperties(UIComponent component) { FacesContext context = FacesContext.getCurrentInstance(); super.setProperties(component); if(value != null) { if (isValueReference(value)) { ValueBinding vb = context.getApplication ().createValueBinding(value); component.setValueBinding(value, vb); } else ((UICustomHTMLOutput)component).setValue(value); } } And my state and encode methods from the UICustomHTMLOutput: @Override public Object saveState(FacesContext context) { Object values[] = new Object[2]; values[0] = super.saveState(context); values[1] = value; return ((Object) (values)); } @Override public void restoreState(FacesContext context, Object state) { Object values[] = (Object[])state; super.restoreState(context, values[0]); value = (String)values[1]; } // component render public void encodeBegin(FacesContext context) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement(p, this); writer.write(value); This is the wrong part. In case of ValueBinding the value is of cause null. you need here the same if else as in setProperties(): if (value != null) { writer.write(value); } else { ValueBinding vb = getValueBinding(value); if (vb != null) { writer.write(vb.getValue(context)); } } Regards, Volker writer.endElement(p); writer.flush(); } Any help is greatly appreciated. Thanks! -Rajiv On 11/05/06, Volker Weber [EMAIL PROTECTED] wrote: Hi Rajiv, JSFSter Smith wrote: Firstly, kudos to the MyFaces team for the recent releases of myfaces 1.1.3 and tomahawk 1.1.2! I am just a few weeks old with JSF and am using it for a current project. So far its been great but I am still getting to know the deatils. I attempted to create a simple custom JSP tag and was able to get it together surprisingly quickly. But I do have a problem now. My tag essentially renders the string in an attribute value. Here is a sample usage: my:testTag value=My message (or) my:testTag value=#{datapanel.description} But the ValueBinding does not seem to work when I try to access a member of the DataPanel bean that is a collection or another class that has members. Examples of these cases are below: t:dataTable value=#{datapanel.sentenceDisplayData} var=each t:column my:testTag value=#{each.part0} / my:testTag value=#{each.part1} / my:testTag value=#{each.part2} / my:testTag value=#{each.part3} / /t:column /t:dataTable (OR) my:testTag value=#{datapanel.summary.length I am including my setProperties method of the TagLib class. Would be great if someone can point out what I am missing here. protected void setProperties(UIComponent component) { /* you have to call the super class */ FacesContext context = FacesContext.getCurrentInstance(); super.setProperties(component); if(value != null) { if (isValueReference(value)) { ValueBinding vb = context.getApplication().createValueBinding(value); component.setValueBinding(value, vb); - remove following -- // forcing the value from the ValueBinding to the component. if(vb != null) { if(vb.getValue(context) != null) ((UIInfactHTMLOutput)component).setValue(vb.getValue (context).toString()); } - / remove following -- Why this? Thats the problem! Here are the valueBinding evaluated at component creation time, but datatable needs eavluation at rendering time! just remove this an it should do. } else ((UIInfactHTMLOutput)component).setValue(value);
Re: [newbie] - simple custom tag problems
Hi Volker, Thanks! yes that was the problem. I am getting a better hang of the JSF rendering framework now and it is pretty powerful! Thanks again. -RajivOn 11/05/06, Volker Weber [EMAIL PROTECTED] wrote: Hi,see inlineJSFSter Smith wrote: Hi Volker, Thanks for your response! I attempted the forcing of the ValueBinding in the setProperties() since setting value of the tag attribute was not passed on to the Component Class. In a case like this: my:testTag value=My message (or) my:testTag value=#{datapanel.description} where description is a String, the contents of the 'value' attribute in the setProperty method of the Tag class are picked up ok. But in the case when the theBean member is not a string (like in the dataTable case), the contents of the value attribute insetProperty() are : #{datapanel.description}. In this case, the getValue() in my Custom Component class is null and the EL does not seem to be processed. My setProperties() method :protected void setProperties(UIComponent component) {FacesContext context = FacesContext.getCurrentInstance();super.setProperties(component);if(value != null){if (isValueReference(value)) {ValueBinding vb = context.getApplication ().createValueBinding(value);component.setValueBinding(value, vb);}else((UICustomHTMLOutput)component).setValue(value);}} And my state and encode methods from the UICustomHTMLOutput: @Overridepublic Object saveState(FacesContext context){Object values[] = new Object[2];values[0] = super.saveState(context);values[1] = value; return ((Object) (values));}@Overridepublic void restoreState(FacesContext context, Object state){Object values[] = (Object[])state; super.restoreState(context, values[0]);value = (String)values[1];}// component renderpublic void encodeBegin(FacesContext context) throws IOException {ResponseWriter writer = context.getResponseWriter();writer.startElement(p, this);writer.write(value);This is the wrong part. In case of ValueBinding the value is of cause null. you need here the same if else as in setProperties():if (value != null) {writer.write(value);} else {ValueBinding vb = getValueBinding(value);if (vb != null) { writer.write(vb.getValue(context));}}Regards,Volkerwriter.endElement(p);writer.flush();} Any help is greatly appreciated. Thanks! -Rajiv On 11/05/06, Volker Weber [EMAIL PROTECTED] wrote: Hi Rajiv, JSFSter Smith wrote: Firstly, kudos to the MyFaces team for the recent releases of myfaces 1.1.3 and tomahawk 1.1.2! I am just a few weeks old with JSF and am using it for a current project. So far its been great but I am still getting to know the deatils. I attempted to create a simple custom JSP tag and was able to get it together surprisingly quickly. But I do have a problem now. My tag essentially renders the string in an attribute value. Here is a sample usage: my:testTag value=My message (or) my:testTag value=#{datapanel.description} But the ValueBinding does not seem to work when I try to access a member of the DataPanel bean that is a collection or another class that has members. Examples of these cases are below: t:dataTable value=#{ datapanel.sentenceDisplayData} var=each t:column my:testTag value=#{each.part0} / my:testTag value=#{ each.part1} / my:testTag value=#{each.part2} / my:testTag value=#{each.part3} / /t:column /t:dataTable (OR) my:testTag value=#{datapanel.summary.length I am including my setProperties method of the TagLib class. Would be great if someone can point out what I am missing here. protected void setProperties(UIComponent component) { /* you have to call the super class */ FacesContext context = FacesContext.getCurrentInstance(); super.setProperties(component); if(value != null) { if (isValueReference(value)) { ValueBinding vb = context.getApplication().createValueBinding(value); component.setValueBinding(value, vb); - remove following -- // forcing the value from the ValueBinding to the component. if(vb != null) { if(vb.getValue(context) != null) ((UIInfactHTMLOutput)component).setValue(vb.getValue (context).toString()); } - / remove following -- Why this? Thats the problem! Here are the valueBinding evaluated at component creation time, but datatable needs eavluation at rendering time! just remove this an it should do. } else ((UIInfactHTMLOutput)component).setValue(value); } } or better implement your set properties using UIComponentTagUtils like this: protected void setProperties(UIComponent component) { super.setProperties(component); UIComponentTagUtils.setValueProperty (getFacesContext(), component, value); } Regards, Volker thanks in advance! -Rajiv -- Don't answer to From: address! Mail to this account are droped if not recieved via mailinglist. To contact me direct create the mail address by concatenating my forename to my senders domain.--Don't answer to From: address!Mail to this account are droped if not recieved via mailinglist.To contact me direct create the mail
[newbie] - simple custom tag problems
Firstly, kudos to the MyFaces team for the recent releases of myfaces 1.1.3 and tomahawk 1.1.2! I am just a few weeks old with JSF and am using it for a current project. So far its been great but I am still getting to know the deatils. I attempted to create a simple custom JSP tag and was able to get it together surprisingly quickly. But I do have a problem now. My tag essentially renders the string in an attribute value. Here is a sample usage: my:testTag value=My message (or) my:testTag value=#{datapanel.description} But the ValueBinding does not seem to work when I try to access a member of the DataPanel bean that is a collection or another class that has members. Examples of these cases are below: t:dataTable value=#{datapanel.sentenceDisplayData} var=each t:column my:testTag value=#{each.part0} / my:testTag value=#{each.part1} / my:testTag value=#{each.part2} / my:testTag value=#{each.part3} / /t:column /t:dataTable (OR) my:testTag value=#{datapanel.summary.length I am including my setProperties method of the TagLib class. Would be great if someone can point out what I am missing here. protected void setProperties(UIComponent component) { /* you have to call the super class */ FacesContext context = FacesContext.getCurrentInstance(); super.setProperties(component); if(value != null) { if (isValueReference(value)) { ValueBinding vb = context.getApplication().createValueBinding(value); component.setValueBinding(value, vb); // forcing the value from the ValueBinding to the component. if(vb != null) { if(vb.getValue(context) != null) ((UIInfactHTMLOutput)component).setValue(vb.getValue(context).toString()); } } else ((UIInfactHTMLOutput)component).setValue(value); } } thanks in advance! -Rajiv
issue with tabbedpane -Illegal to flush within a custom tag
Hi Iam Using the Tabbed pane component from the Tomahawk from myFaces. Iam unable to use the include jsp tag inside a paneltab tag. Iam facing the following exception. == message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: javax.servlet.jsp.JspException: Illegal to flush within a custom tag javax.faces.webapp.FacesServlet.service(FacesServlet.java:125) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) root cause javax.faces.FacesException: javax.servlet.jsp.JspException: Illegal to flush within a custom tag net.sourceforge.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:410) net.sourceforge.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:241) net.sourceforge.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:287) javax.faces.webapp.FacesServlet.service(FacesServlet.java:110) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs. This Exception is because the f:view tag is not allowed inside the paneltab tag. Is there is any way to use the same. Iam also unable to design a html table inside the tab pane. Kindly clarify me Please email to the same address from which this mail comes. Thanks Rajkumar
Re: issue with tabbedpane -Illegal to flush within a custom tag
On 5/3/06, Desigachari, Rajkumar (Cognizant) [EMAIL PROTECTED] wrote: This Exception is because the f:view tag is not allowed inside the paneltab tag. Is there is any way to use the same. If that's the only cause of the error (and it may not be), then use f:subview wherever you are currently using f:view in your included file.
Illegal to flush within a custom tag
Why this error occurred? javax.faces.FacesException: javax.servlet.jsp.JspException: ServletException in '/page/index.jsp': Illegal to flush within a custom tag at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(S ervletExternalContextImpl.java:422) at org.apache.shale.tiles.TilesViewHandler.dispatchToTile(TilesViewHandler. java:318) at org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java :159) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:367 ) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:173) at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter( AdfFacesFilterImpl.java:367) at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(Ad fFacesFilterImpl.java:336) at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFace sFilterImpl.java:196) at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java :87) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1 48) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:85 6) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC onnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint .java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow erWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool .java:684) at java.lang.Thread.run(Thread.java:595) Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: ServletException in '/page/index.jsp': Illegal to flush within a custom tag at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageCont extImpl.java:844) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex tImpl.java:781) at org.apache.jsp.page.layout_jsp._jspService(org.apache.jsp.page.layout_js p:77) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:322) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:173) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:672) at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applicatio nDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp atcher.java:398) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispat cher.java:301) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(S ervletExternalContextImpl.java:416) ... 24 more Enviroment: Tiles-core Shale-tiles Myfaces 1.1.3 snapshot [EMAIL PROTECTED] uri=http://java.sun.com/jsf/core; prefix=f% [EMAIL PROTECTED] uri=http://java.sun.com/jsf/html; prefix=h% [EMAIL PROTECTED] uri=http://xmlns.oracle.com/adf/faces; prefix=af% [EMAIL PROTECTED] uri=http://xmlns.oracle.com/adf/faces/html; prefix=afh% [EMAIL PROTECTED] uri=http://struts.apache.org/tags-tiles; prefix=tiles% Tiles-definitions definition name=mainLayout path=/page/layout.jsp put name=content value=/put /definition definition name=/page/index extends=mainLayout put name=content value=/page/index.jsp/put /definition Layout.jsp --- f:view
myFaces Tiles - Illegal to flush within a custom tag
Hello all again, This may not be the right place to ask, but I will anyway. Ive got some pages that are JSF/MyFaces pages I want to use some Tiles insert statements. When I do I get the error javax.servlet.ServletException: Can't insert page '/test.jsp' : Illegal to flush within a custom tag This works %@ taglib uri=http://struts.apache.org/tags-tiles prefix=tiles % html body tiles:insert page=/test.jsp flush=true/ f:view // cant place tiles: in here /f:view /body /html This doesnt %@ taglib uri=http://struts.apache.org/tags-tiles prefix=tiles % html body f:view tiles:insert page=/test.jsp flush=true/ /f:view /body /html Any idea people? Or tips on where to look for an answer. Thanks Jeff. Tools struts-1.2.7 myfaces-1.1.1.zip
RE: myFaces Tiles - Illegal to flush within a custom tag
Its Friday. Its my only excuse. Solved by tiles:insert page=/test.jsp flush=false/ (dont know how I missed that blonde moment.) sorry jeff -Original Message- From: Jeffrey Porter [mailto:[EMAIL PROTECTED] Sent: 04 November 2005 16:20 To: MyFaces Discussion Subject: myFaces Tiles - Illegal to flush within a custom tag Hello all again, This may not be the right place to ask, but I will anyway. Ive got some pages that are JSF/MyFaces pages I want to use some Tiles insert statements. When I do I get the error javax.servlet.ServletException: Can't insert page '/test.jsp' : Illegal to flush within a custom tag This works %@ taglib uri=http://struts.apache.org/tags-tiles prefix=tiles % html body tiles:insert page=/test.jsp flush=true/ f:view // cant place tiles: in here /f:view /body /html This doesnt %@ taglib uri=http://struts.apache.org/tags-tiles prefix=tiles % html body f:view tiles:insert page=/test.jsp flush=true/ /f:view /body /html Any idea people? Or tips on where to look for an answer. Thanks Jeff. Tools struts-1.2.7 myfaces-1.1.1.zip