Adding components dynamically

Hi All, My application demands addition of UI components dynamically at runtime. I heard that it is possible to add the components at runtime. Can anybody please tell me how can I achieve this?

Thanks in advance.

Josh Juneau

Ranch Hand

Posts: 86

posted 12 years ago

I am not sure what you mean by dynamically adding components at runtime. It is certainly possible to "hide" or "unhide" components at runtime via the "rendered" attribute. This attribute can be bound to a backing-bean boolean property.

For instance, you can have a backing-bean method which performs some kind of calculation, and based upon the outcome it can set your property to true or false...which would then "render or unrender" the component onscreen.

Josh Juneau

Database Administrator/Application Developer

Varun Khanna

Ranch Hand

Posts: 1400

posted 12 years ago

The entire component tree is present on the server and the component tree can be manipulated, you can create new components as children of other components.

- Varun

Venkateswaran VelRajan

Greenhorn

Posts: 3

posted 12 years ago

In my application I have added RadioButton at Run time into a panel. I have tried to get the MetaInformation of my DataBase with tables Papers With Fields ... PaperId,PaperName Presentation With Fields ... PresId,PresName Rules With Fields ... RuleId,Rule

The RadioButtons will be listed depends upon the number of fields in the table selected from the ComboBox. I hope the code will helps u.

Originally posted by surya sudhakar: Hi All, My application demands addition of UI components dynamically at runtime. I heard that it is possible to add the components at runtime. Can anybody please tell me how can I achieve this?

Thanks in advance.

You might take a look at the example code posted for a Shale enhancement. It would provide an example of what you are describing.