• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF Ajax Implementation for dynamic components :SelectOneRadio

 
SunilM Raikar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one please let me know how can i add ajax behaviour to dynamically created SelectOneRadio.
I want to get the below xhtml functionality programmatically:


And Bean



Can anyone of you be kind enough to help me on this?

Thanks.
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever possible, I recommend using templated UI constructs over programmatically-generated ones. They're simpler, easier to maintain, and less likely to break when JSF is updated.

Having issued that warning, the way that you construct/update JSF components programmatically is by using the "binding=" attribute on a template tag to establish a binding between the UIComponent and the backing bean. Typically if I need to do this (and of all the apps I've done, only one of them ever needed to), I'll bind to a container such as a panelGrid and insert/update/delete child components within that container.

The actual programming is straightforward. The UIComponent classes of the various JSF tags are all JavaBeans, so instead of coding the tag and attributes, you construct a component and set its properties. And link it to the binding point.

The java code is straightforward, if somewhat tedious. The main problem has to do with properties that are managed as EL expressions. For example, you cannot simple set the "value=" property by calling the UIComponent's setValue() method, because that sets an EL expression that references a value, not the value itself.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!