RichFaces4不渲染组件 [英] RichFaces4 don't render the components

查看:98
本文介绍了RichFaces4不渲染组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试运行RichFaces4应用程序,但组件不呈现。例如,当我尝试此演示时:演示我得到这样的结果:

I try to run RichFaces4 app but the components don't render. For example when I try this demo: Demo I get something like this:

Here is an example of default tab panel with 3 tabs.



 j_id1475365623_57f04a9f j_id1475365623_57f04a9f j_id1475365623_57f04a9f 
 j_id1475365623_57f04a75 j_id1475365623_57f04a75 j_id1475365623_57f04a75 
 j_id1475365623_57f04a6b j_id1475365623_57f04a6b j_id1475365623_57f04a6b 



«
↓
»
Here is tab #1



Here is an example of tab panel switched in "ajax" style. Second tab is disabled.



 j_id1475365623_57f04a27 j_id1475365623_57f04a27 j_id1475365623_57f04a27 
 j_id1475365623_57f04a1d j_id1475365623_57f04a1d j_id1475365623_57f04a1d 
 j_id1475365623_57f04bf3 j_id1475365623_57f04bf3 j_id1475365623_57f04bf3 



«
↓
»
Here is tab #1



Here is an example of tab panel switched completely on client.



 j_id1475365623_57f04bcf j_id1475365623_57f04bcf j_id1475365623_57f04bcf 
 j_id1475365623_57f04ba5 j_id1475365623_57f04ba5 j_id1475365623_57f04ba5 
 j_id1475365623_57f04b9b j_id1475365623_57f04b9b j_id1475365623_57f04b9b 



«
↓
»
Here is tab #1
Here is tab #2
Here is tab #3

我的代码与演示中的代码几乎相同。我刚刚添加了表单标签,因为它抱怨它。

My code is almost the same as in the demo. I just added form tag becouse it complained for it.

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
    <p>Here is an example of default tab panel with 3 tabs.</p>
    <h:form>
    <rich:tabPanel>
        <rich:tab label="First">
            Here is tab #1
        </rich:tab>
        <rich:tab label="Second">
            Here is tab #2
        </rich:tab>
        <rich:tab label="Third">
            Here is tab #3
        </rich:tab>
    </rich:tabPanel>
    <br/><br/>
    <p>Here is an example of tab panel switched in "ajax" style. Second tab is disabled.</p>
    <rich:tabPanel switchType="ajax">
        <rich:tab label="First">
            Here is tab #1
        </rich:tab>
        <rich:tab label="Second" disabled="true">
            Here is tab #2
        </rich:tab>
        <rich:tab label="Third">
            Here is tab #3
        </rich:tab>
    </rich:tabPanel>
    <br/><br/>
    <p>Here is an example of tab panel switched completely on client.</p>
    <rich:tabPanel switchType="client">
        <rich:tab label="First">
            Here is tab #1
        </rich:tab>
        <rich:tab label="Second">
            Here is tab #2
        </rich:tab>
        <rich:tab label="Third">
            Here is tab #3
        </rich:tab>
    </rich:tabPanel>
    </h:form>
</ui:composition>


推荐答案


那是什么Crome开发者工具告诉我 http://img571.imageshack.us/i/rfnotdefined.jpg(未捕获的ReferenceError:未定义RichFaces)

That's what Crome Developer Tools told me http://img571.imageshack.us/i/rfnotdefined.jpg (Uncaught ReferenceError: RichFaces is not defined)

这意味着RichFaces的必要JavaScript文件未被删除在生成的HTML < head> 中提供。您需要确保使用JSF < h:head> 组件而不是纯HTML < head> 。这就是新的JSF 2.0资源注入机制的mandatroy,JSF和RichFaces将在那里注入与Ajax / UI相关的JavaScripts / Stylesheets。

This means that the necessary JavaScript files of RichFaces are not been supplied in the generated HTML <head>. You need to ensure that you're using the JSF <h:head> component instead of plain HTML <head> in the template. This is namely mandatroy for the new JSF 2.0 resource injection mechanism, JSF and RichFaces will inject Ajax/UI-related JavaScripts/Stylesheets in there.

我不知道是否有任何东西已在服务器日志中记录缺少< h:head> 。密切关注服务器日志。

I however wonder if anything has been logged in the server log about the lack of the <h:head>. Keep an eye on the server logs.

这篇关于RichFaces4不渲染组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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