PrimeFaces组件的自定义渲染器在Tomcat中可以正常工作,但在Websphere中不能正常工作 [英] Custom renderer for PrimeFaces component works fine in Tomcat, but not in Websphere

查看:103
本文介绍了PrimeFaces组件的自定义渲染器在Tomcat中可以正常工作,但在Websphere中不能正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MyFaces 2.1.9和PrimeFaces 3.5.我已经为<p:inputText>实现了自定义渲染器.这在Tomcat上可以正常使用.但这不适用于Websphere.我已经在自定义渲染器类中放置了断点,但是它们从未被击中.我在日志中也看不到任何内容.但是,当我在标准JSF <h:inputText>上注册完全相同的自定义渲染器时,它就可以正常工作.

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.

我已经在faces-config.xml中将其注册如下:

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?

推荐答案

需要覆盖第三方组件库的渲染器的自定义渲染器需要在webapp自己的faces-config.xml中注册,而不是在打包在其中的faces-config.xml中注册/WEB-INF/lib中的另一个JAR. JAR文件的加载顺序未指定,因此可能会在您要覆盖的第三方组件库之一的之前加载并注册自定义渲染器,就像您面对的一样

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.

这篇关于PrimeFaces组件的自定义渲染器在Tomcat中可以正常工作,但在Websphere中不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆