2011-11-18 214 views
2

我想延長一些primefaces組件渲染器類的做同樣的修改我註冊在面臨新的渲染器配置JSF 2.0 PrimeFaces渲染覆蓋

<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("*"); 

    } 



} 

回答

12
 <renderer> 
      <component-family>org.primefaces.component</component-family> 
      <renderer-type>org.primefaces.component.CommandButtonRenderer</renderer-type> 
      <renderer-class>ExtendedTags.myCommandButton</renderer-class> 
     </renderer> 
+0

謝謝你的快速反應我剛剛發現了這個問題,併發布了答案。 – maniacneron