DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
You can use the same technique described in http://cwiki.apache.org/WICKET/forms-with-dynamic-elements.html
to dynamically add components to a page.
Wicket xhtml tag <wicket:container> comes in handy on these cases. Bellow is a simple example of a page with dynamic components:
MasterPage.java
public class MasterPage extends WebPage
{
public MasterPage()
{
List<Component> components = new ArrayList<Component>();
components.add( new Component() );
components.add( new Component() );
add( new ListView( "components", components )
{
protected void populateItem(ListItem item)
{
item.add( (Component)item.getModelObject() );
}
});
}
}
MasterPage.html
<html>
<body>
<wicket:container wicket:id="components">
<wicket:container wicket:id="component"/>
</wicket:container>
</body>
</html>
{code:html}
Component.java
public class Component extends Panel
{
public Component()
Unknown macro: { super( "component" ); add( new Label( "name" ), "component 1" ); }
}
<html>
<wicket:panel>
<span wicket:id="name">component name</span>
</wicket:panel>
</html>