In wicket 1.4.x I have custom Container + panel for my pages:
example:
MyPage.java
public class MyPage extends WebPage {
public MyPage(){
add(new CustContainer, "custContainer");
}
}
MyPage.html
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<head></head>
<body>
<div wicket:id="custContainer"></div>
</body>
</html>
Custcontainer.java
public class CustContainer extends WebMarkupContainer {
private Component comp;
public CustContainer(String id){
super(id);
this.comp = new CustPanel("custPanel");
}
@Override
protected void onRender(MarkupStream markupStream) {
comp.render(getMarkupStream());
}
}
CustPanel.java
public class CustPanel extends Panel {
public CustPanel(String id){
super(id);
add(new Label("label1","This is my Label"));
}
}
CustPanel.html
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div><span wicket:id="label1"></span></div>
</wicket:panel>
</html>
In wicket 1.4.x this code (which is simplified) works very well, but in wicket 9 Component.render() method have removed MarkupStream as param. And when I'm trying to just Component.render() it does not understand anymore that it needs to take custPanel.html <div><span wicket:id="label1"></span></div>
part and insert into MyPage.html markup inside <div wicket:id="custContainer"> HERE </div>
Question: anyone have idea how to solve this issue ? because adding <div wicket:id="custPanel"></div>
into
custContainer div block is not a option because I need to add these panels/component id's dynamically from db:
example:
<div wicket:id="custContainer"> <div wicket:id="custPanel"></div> </div>
So I somehow need to add <div wicket:id="custPanel">
into custContainer div block before rendering markup.
BTW:
@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
is not a solution, its only changes markup after markup render and exception is thrown.
Long story short: I want all CustPanel.html wicket body included into MyPage.html div block with wiket id = custContainer
<div wicket:id="custContainer">HERE I need CustPanel.html wicket content to be rendered/included</div>