1. Add a button, and a group panel
2. Right click on the Group Panel component in the designer and select Add Binding Attribute.
3. Double click on the SessionBean1 node in the Projects window to open the Java editor.
4. In the Java editor, right click in an empty space and select Insert Code... > Add Property...
5. Add property named counter with type int and initial value 1.
![]() |
int count = getSessionBean1().getCounter();
UIComponent parent = groupPanel1;
StaticText newOne = new StaticText();
newOne.setId("newOne" + count);
newOne.setText("This is statictext" + count);
boolean childAdded = parent.getChildren().add(newOne);
getSessionBean1().setCounter(count + 1);
Each press of the button will add a new staticText to the group panel.
| addCounter.jpg | ![]() |
55481 bytes |