2016-08-16 53 views
1

我想在組件中傳遞html,類似於angularjs與transclude:true(指令)的做法。在Apache Wicket組件中transclude的HTML

假設我有這個網站

<div wicket:id="myComponent> My content </div> 

我想,我指定組件上寫「我的內容」。 在MyComponent.html:

<wicket:panel> 
//Some other code 
TRANSCLUDE HERE: "My content" should be here. 
</wicket:panel> 

在此先感謝

+0

如果我的理解,得出WebMarkupContainder(更高的成分太)和實施OnComponentTagBody() –

回答

2

這是org.apache.wicket.markup.html.border.Border組件相同。

邊境的標記看起來像:

<wicket:border> 
    // some HTML with or without wicket:id here 
<wicket:body/> 
    // some more HTML with or without wicket:id here 
<wicket:border> 

在使用的網站,你有:

<div wicket:id="myborder"> 
    // anything here will replace <wicket:body/> in the snippet above 
</div> 
+0

謝謝你,完美的工作。 – delpo