我正在尝试扩展一些primefaces组件渲染器类以进行相同的更改我在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>
我可以看到它调用了渲染器的构造函数,但没有调用其他重写的函数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("*");
}
}
答案 0 :(得分:11)
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.CommandButtonRenderer</renderer-type>
<renderer-class>ExtendedTags.myCommandButton</renderer-class>
</renderer>