• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to render p:outputPanel from p:selectOneRadio  RSS feed

 
Randy Maddocks
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I am trying to render a p:outputPanel when user clicks a radio button inside a p:selectOneRadio. To confirm if the p:ajax listener was invoking the method in the backing bean I dropped in a System.out.println in the method and did see output in the IDE console when I clicked one of the radio buttons. But, for some reason the component is just not rendering. If I set the rendered tag to "true", or, leave the render tag out altogether the p:outputPanel component shows (I did that to make sure it wasn't something outside of the listener and rendering process). I also tried adding an update="createSearchOutputPanel" tag to p:ajax, but that had no impact.

Here is the key code I am referring to:



I am using Primefaces 5.0, JSF 2.2, JDK 1.7, NetBeans 8.0

Any help would be greatly appreciated. Thank you.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not current on PrimeFaces, but I believe that the JSF 2.0 equivalent of the p:ajax tag would be:

However, sometimes you have to get a little more creative in the "render=" reference ID expression, if the tag needs to walk up and down the component tree to find the ID.

I think you probably have an issue with your "rendered" EL expression on the createOutputSearchPanel component. What the EL expression "#{identifyClientType.isClientTypeClicked}" is going to do is locate backing bean identifyClientType and attempt to invoke a method named "public boolean isIsClientTypeClicked(). Because it's a property accesor reference expression. For a non-boolean property, it would be looking for "getIsClientTypeChecked", although I think that that's also an option on JavaBeans when there's no "is" method for a boolean return type.
 
Randy Maddocks
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

Many thanks for your quick response. I agree, I think there is something amiss with the "rendered" EL expression. I can't help but think that the code doesn't seem to be breaking any rules as far as what component(s) can or cannot be rendered via a p:ajax from a separate component. I know you can't use the "update" tag in p:ajax if the parent component of your target is a p:fieldset (which is what I had as the target parent component at first, and which is why it is now wrapped in a p:outputPanel component). In fact, wrapping it in a p:outputPanel and then referencing that in the "update" tag of the p:ajax component in the source component is supposed to be the solution. But I think I am missing something there...

I am going to take a closer look at the EL expression, maybe do some more digging online to get a better perspective on how that works.

Funny, all through my code project I use many instances of p:ajax listeners to cause specific outcomes to happen between source and target components, this is the first time I haven't been able to get it to work.

As always, your feedback is greatly appreciated. If I get anywhere with this I will definitely post the results, in case someone else out there runs into this kind of situation.

Cheers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!