问题
I'm using MyFaces 2.1.9 and PrimeFaces 3.5. I've implemented a custom renderer for <p:inputText>
. This works fine at home with Tomcat. But this does not work at work with Websphere. I've placed breakpoints in the custom renderer class, but they are never hit. I see nothing in my logs as well. However, when I register the very same custom renderer on standard JSF <h:inputText>
, then it works fine.
I've registered it as follows in faces-config.xml
:
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.InputTextRenderer</renderer-type>
<renderer-class>xxx.xxx.xxx.MyInputRenderer</renderer-class>
</renderer>
</render-kit>
How can I troubleshoot the registration of the custom renderer?
回答1:
Custom renderers which needs to override renderers of 3rd party component libraries needs to be registered in webapp's own faces-config.xml
, not in a faces-config.xml
which is packed in another JAR in /WEB-INF/lib
as well. The loading order of JAR files is unspecified, so it may happen that the custom renderer is loaded and registered before the one of the 3rd party component library which you'd like to override, exactly like as you faced.
来源:https://stackoverflow.com/questions/15919624/custom-renderer-for-primefaces-component-works-fine-in-tomcat-but-not-in-websph