JSF 2.0 PrimeFaces 渲染器覆盖
我正在尝试扩展一些 primefaces 组件渲染器类以进行相同的更改,我在 faces 配置中注册新的渲染器,
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.CommanButton</renderer-type>
<renderer-class>ExtendedTags.myCommandButton</renderer-class>
</renderer>
</render-kit>
我可以看到它调用渲染器的构造函数,但没有调用其他重写的函数encodeBegin、encodeEnd 等。我是否遗漏了什么? primefaces 组件是否有任何特殊添加?这是我的渲染器类
public class myCommandButton extends CommandButtonRenderer{
public myCommandButton() {
System.out.println("button constructor");
}
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
System.out.println("button encode begin");
super.encodeBegin(context, component);
ResponseWriter writer = context.getResponseWriter();
writer.write("*");
}
}
I am trying to Extend some of the primefaces components renderer class to make same changes i register new renderer in the faces config
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.CommanButton</renderer-type>
<renderer-class>ExtendedTags.myCommandButton</renderer-class>
</renderer>
</render-kit>
i can see that it calls the constructor of the renderer but not the other overridden functions encodeBegin encodeEnd etc. am i missing something? Is there any special addition for primefaces components? Here is my Renderer Class
public class myCommandButton extends CommandButtonRenderer{
public myCommandButton() {
System.out.println("button constructor");
}
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
System.out.println("button encode begin");
super.encodeBegin(context, component);
ResponseWriter writer = context.getResponseWriter();
writer.write("*");
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)