Dynamic elements in a pagePage added by Ricardo MayerhoferYou 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 Unknown macro: {
super( "component" );
add( new Label( "name" ), "component 1" );
}
} <html>
Change Notification Preferences
View Online
|
Add Comment
|
- [CONF] Apache Wicket > Dynamic elements in a page confluence
