我尝试运行 RichFaces4 应用程序,但组件未呈现。例如,当我尝试这个演示时:Demo我得到这样的东西:
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
我的代码与演示中的代码几乎相同。我只是添加了表单标签,因为它提示它。
<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>
最佳答案
That's what Crome Developer Tools told me http://img571.imageshack.us/i/rfnotdefined.jpg (Uncaught ReferenceError: RichFaces is not defined)
这意味着生成的 HTML 中未提供必要的 RichFaces JavaScript 文件 <head>
.您需要确保您使用的是 JSF <h:head>
组件而不是纯 HTML <head>
在模板中。这就是新的 JSF 2.0 资源注入(inject)机制的强制要求,JSF 和 RichFaces 将在其中注入(inject)与 Ajax/UI 相关的 JavaScripts/样式表。
但是我想知道服务器日志中是否记录了关于缺少 <h:head>
的任何信息.密切关注服务器日志。
关于java - RichFaces4 不渲染组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5758434/