首页 > 解决方案 > p:toolbar 不显示,虽然其他元素工作正常

问题描述

我有下面的代码来显示一个编辑器和工具栏,不知何故工具栏没有显示,我只是得到一条大细线(屏幕截图中的黄色突出显示)。

我使用了这里的工具栏代码。

有人可以帮我指出这个问题吗,我搜索并看到 jquery 可能是问题,但我没有明确加载任何 jquery 或其他库。另外,我的编辑器工作正常,但工具栏不行。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

<h:head>
</h:head>
<h:body>
    <h1>Hello World PrimeFaces</h1>

    <h:form>

        <p:editor></p:editor>

        <br></br>

        <p:toolbar>
        <f:facet name="left">
            <p:commandButton type="button" title="Save" icon="ui-icon-disk" />
            <p:commandButton type="button" title="Delete" icon="ui-icon-trash" />
            <p:commandButton type="button" title="Print" icon="ui-icon-print" />
        </f:facet>


    </p:toolbar>

    </h:form>

</h:body>
</html>

在此处输入图像描述

标签: jsfprimefaces

解决方案


我克隆了 PrimeFaces 测试项目:https ://github.com/primefaces/primefaces-test

将您上面的确切代码输入到test.xhtml.

然后我运行项目mvn clean jetty:run并导航到http://localhost:8080/primefaces-test/test.xhtml

这是我的截图。

在此处输入图像描述


推荐阅读