Re: Custom tag
Hi You can try the alternate syntax using "targets". For example: 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 : > again, > > > > value="Ok" rendered="#{not empty cc.attrs.action and > empty cc.attrs.actionListener}" > action="#{cc.attrs.action}" > /> > > > value="Ok" rendered="#{not empty cc.attrs.actionListener and > empty cc.attrs.action}" > actionListener="#{cc.attrs.actionListener}" > /> > > value="Ok" rendered="#{not empty cc.attrs.actionListener and > not empty cc.attrs.action}" > actionListener="#{cc.attrs.actionListener}" > action="#{cc.attrs.action}" > /> > > > > > 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 > Para: MyFaces Discussion > Cc: > Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 > Assunto: Re: Custom tag > > you can try: > > > > value="Ok" rendered="#{not empty cc.attrs.action and > empty cc.attrs.actionListener}" > action="#{cc.attrs.action}" > /> > > > value="Ok" rendered="#{not empty cc.attrs.actionListener and > empty cc.attrs.action}" > actionListener="#{cc.attrs.actionListener}" > action="#{cc.attrs.action}" > /> > > value="Ok" rendered="#{not empty cc.attrs.actionListener and > not empty cc.attrs.action}" > actionListener="#{cc.attrs.actionListener}" > /> > > > > > > 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 > Para: MyFaces Discussion > Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 > Assunto: Custom tag > > Hi i have this: > > Simple custom tag: > > > > > > > > value="Ok" > action="#{cc.attrs.action}" > actionListener="#{cc.attrs.actionListener}" > /> > > > Then in my page i do: > > > > 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. > 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 : > Hi > > You can try the alternate syntax using "targets". For example: > > > > > > > > > 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 : >> again, >> >> >> >> > value="Ok" rendered="#{not empty cc.attrs.action and >> empty cc.attrs.actionListener}" >> action="#{cc.attrs.action}" >> /> >> >> >> > value="Ok" rendered="#{not empty cc.attrs.actionListener and >> empty cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> /> >> >> > value="Ok" rendered="#{not empty cc.attrs.actionListener and >> not empty cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> action="#{cc.attrs.action}" >> /> >> >> >> >> >> 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 >> Para: MyFaces Discussion >> Cc: >> Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 >> Assunto: Re: Custom tag >> >> you can try: >> >> >> >> > value="Ok" rendered="#{not empty cc.attrs.action and >> empty cc.attrs.actionListener}" >> action="#{cc.attrs.action}" >> /> >> >> >> > value="Ok" rendered="#{not empty cc.attrs.actionListener and >> empty cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> action="#{cc.attrs.action}" >> /> >> >> > value="Ok" rendered="#{not empty cc.attrs.actionListener and >> not empty cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> /> >> >> >> >> >> >> 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 >> Para: MyFaces Discussion >> Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 >> Assunto: Custom tag >> >> Hi i have this: >> >> Simple custom tag: >> >> >> >> >> >> >> >> > value="Ok" >> action="#{cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> /> >> >> >> Then in my page i do: >> >> >> >> 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. >> > 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 Para: MyFaces Discussion 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 : > Hi > > You can try the alternate syntax using "targets". For example: > > > > > > > > > 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 : >> again, >> >> >> >> > value="Ok" rendered="#{not empty cc.attrs.action and >> empty cc.attrs.actionListener}" >> action="#{cc.attrs.action}" >> /> >> >> >> > value="Ok" rendered="#{not empty cc.attrs.actionListener and >> empty cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> /> >> >> > value="Ok" rendered="#{not empty cc.attrs.actionListener and >> not empty cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> action="#{cc.attrs.action}" >> /> >> >> >> >> >> 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 >> Para: MyFaces Discussion >> Cc: >> Enviadas: Quinta-feira, 28 de Junho de 2012 23:12 >> Assunto: Re: Custom tag >> >> you can try: >> >> >> >> > value="Ok" rendered="#{not empty cc.attrs.action and >> empty cc.attrs.actionListener}" >> action="#{cc.attrs.action}" >> /> >> >> >> > value="Ok" rendered="#{not empty cc.attrs.actionListener and >> empty cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> action="#{cc.attrs.action}" >> /> >> >> > value="Ok" rendered="#{not empty cc.attrs.actionListener and >> not empty cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> /> >> >> >> >> >> >> 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 >> Para: MyFaces Discussion >> Enviadas: Quinta-feira, 28 de Junho de 2012 18:28 >> Assunto: Custom tag >> >> Hi i have this: >> >> Simple custom tag: >> >> >> >> >> >> >> >> > value="Ok" >> action="#{cc.attrs.action}" >> actionListener="#{cc.attrs.actionListener}" >> /> >> >> >> Then in my page i do: >> >> >> >> 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. >> > actionListener="#{myBean.actionListenerMethod}"/> >> >> how can i avoid this? >> >> Thanks >> >> --- >> SCJA. José Luis Cetina >> --- >> -- --- SCJA. José Luis Cetina ---
Message order in h:messages does not match component order
Hi, with template: messages in h:messages does not match order of components, h:messages will show: 2: Validation error 3: Validation error 1: Validation error It looks like that problem occurs where h:messages is wrapped in another component, this works: but this doesn't: With Mojarra h:messages or PrimeFaces p:messages message order does match component order. Should I file this as bug? Regards, Pavel