我寫了一個擴展爲UIComponentBase
的自定義標籤。
它在encodeBegin
方法中添加了多個子組件(UIComponent
)。h:panelGrid中的多個子組件的自定義Facelets-Tag
爲了佈局的目的,我想將這個Child-Components嵌套在h:panelGrid
,
中,但標籤在這裏的方式。
ExampleTag.java
private ExampleTag extends UIComponentBase {
public void encodeBegin(FacesContext context) throws IOException {
getChildren().add(new HtmlLabel());
getChildren().add(new HtmlOutputText();
}
}
ExampleOutput.xhtml
<html>
<h:panelGrid columns="2">
<foo:exampleTag />
<foo:exampleTag />
</h:panelGrid>
</html>
所生成的輸出將具有在同一小區的HtmlLabel
和HtmlOutput
組件,
但我想將它們排成一行,即兩個單元格。
@ user745359:**歡迎使用StackOverflow!**我建議你改變你的名字和(可選)你的照片。問候 – 2011-05-09 18:17:09