我写了一个自定义标签扩展UIComponentBase
.
它在方法期间添加了多个子组件(UIComponent
)encodeBegin
。
出于布局目的,我想将此 Child-Components 嵌套在 a 中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
组件,
但我希望将它们放在一行中,即两个单元格。