Meaningless Drivel is fun!
The moose likes JSF and the fly likes Dynamic JSF, programatically adding components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Dynamic JSF, programatically adding components" Watch "Dynamic JSF, programatically adding components" New topic

Dynamic JSF, programatically adding components

Rui Azevedo

Joined: May 30, 2010
Posts: 20
Hey guys!

In a project I'm ivolved in I have to dynamically add some components. All was going well until I had to generate data tables dynamically. I'm iterating a list of "SomeObject" and when I try to access a property of that object Glassfish tells me that object doesn't have such a property that is readable. I have getters for those properties and SomeObject implements Serializable as well. I used BalusC resources but I'm having no luck. Tell me if you need any more detail. Thanks.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Please post your .xhtml file
Rui Azevedo

Joined: May 30, 2010
Posts: 20
Hmm.. My .xhtml is this:

and this is the DynamicForm bean:

And this is the data table component, the one that's giving me problems:

The addComponent method ignores the bindingValue parameter, and the selectableOptions here evaluates to a list a of KeyValueItem. Which I present next:

When i try to run the project Glassfish tells me KeyValueItem doesn't have a readable property 'chave'.

It's a lot of code to go through, so if you can sort through it you have my deepest thanks.
Mabura Zeguru

Joined: Sep 10, 2014
Posts: 1

This may shed some light... in the right direction ... i hope ;-)

For PrimeFaces i do the following...

Full example in this blog post
It is sorta covered in the JavaRanch Style Guide.
subject: Dynamic JSF, programatically adding components
It's not a secret anymore!