无法从命令按钮显示面板

Can't show panel from commandbutton

<h:form>
    <p:commandButton onclick="PF('panel1').show()" value="Show Panel" type="button" />
</h:form>

这是我试图显示面板的按钮:

<p:panel rendered="#{carBean.show}" widgetVar="panel1">
    <h:form id="createCarForm" class="form-horizontal" >
        <div class="form-group">
            <div class="col-sm-4"></div>
            <div class="col-sm-4">
                <h2>Create Car Record</h2>
            </div>
        </div>
    </h:form>
</p:panel>

这是我要显示的面板。

如果在 rendered="#{carBean.show}" 中 'show' 等于 false,则生成的组件不会出现在客户端 html(或服务器端视图)中。这就是渲染的作用。如果您希望面板最初不可见,您应该准确地使用 visible 属性。

<p:panel visible="#{carBean.show}" widgetVar="panel1">
 ...
</p:panel>

您应该可以按照您定义的方式使用 commandButton。

 <p:commandButton onclick="PF('panel1').show()" value="Show Panel" type="button" />