【发布时间】:2010-10-13 20:20:56
【问题描述】:
我有一个扩展 UIComponent 和 UIOutput 的标记类。在这个类中,我有 encodeBegin 和 encodeEnd ,我可以使用我的 contextWriter 输出任何我想要的 html 标签,方法是使用 writer.startElement("div", myComponent) 等等。
我现在的问题是我需要插入例如 a 而不是使用 writer.startElement。我可以通过 getChildren().add(HtmlCommandButton button = new HtmlCommandButton());但是当这样做时,我似乎无法输出我希望它们出现的组件,就像我可以使用 write.startElement 一样。
在我如何利用我自己的标签库中的richfaces 标签、JSF 标签和类似标签方面,有人有什么好的解决方案吗?简而言之,我真正想做的是在我的 encodeBegin 中:
writer.startElement("a4j:commandButton", myComponent);
writer.writeAttribite("action", "#{Handler.myAction}", null);
writer.endElement("a4j:commandButton");
提前致谢
【问题讨论】:
标签: jsf taglib uicomponents