notificationBar没有出现

时间:2014-05-27 21:09:09

标签: jsf primefaces notifications show

我有以下XHTML页面。 重点是我想在用户点击按钮时显示通知。但我不知道为什么,当我点击按钮时,通知根本不会出现。

<!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:c="http://java.sun.com/jsp/jstl/core"
      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>
    <f:metadata>
        <f:viewParam name="partyname" value="#{personalPageBean.party.name}"/>
    </f:metadata>
    <h:body>
        <p:notificationBar position="top" effect="slide" widgetVar="bar" styleClass="top">
                    <h:outputText value="What PrimeFaces has so far is just the beginning!" style="font-size:36px;" />
             </p:notificationBar>
        <ui:include src="../horizontal_menu.xhtml">
        </ui:include>
        <c:choose>
        <c:when test="#{personalPageBean.memberOfParty}">

            <p:panel id="panel" header="#{personalPageBean.party.name}" style="margin-bottom:10px;">
                <h:panelGrid columns="2">

                    <h:outputLabel for="symbol" value="Symbol:" />
                    <h:graphicImage value="#{('../partysymbols/'.concat(personalPageBean.party.symbol))}" width="200" height="171" />

                    <h:outputLabel for="program" value="Program:" />
                    <h:outputLabel id="program" value="#    {personalPageBean.party.program}" />
                    <h:link id="partyname" outcome="../memberlist" value="memberlist">
                        <f:param  name="partyname" value="#    {personalPageBean.party.name}" /> 
                    </h:link>

                    <p:commandButton value="Show" onclick="bar.show()" type="button" />
                </h:panelGrid>
                </p:panel>
        </c:when>   
        <c:otherwise>
            <h1>You aren't member of a party.</h1>
            <h:link outcome="personalpage">my personal page</h:link>    
        </c:otherwise>
        </c:choose>
    </h:body>
</html>

所以,对不起,如果我复制了整个页面,但我真的不知道错误在哪里。

感谢你们所有人提前

1 个答案:

答案 0 :(得分:0)

试试这个:

对于吧:

<p:notificationBar position="top" effect="slide" styleClass="top" widgetVar="bar">
    <h:outputText value="What PrimeFaces has so far is just the beginning!" style="font-size:36px;" />
</p:notificationBar>

按钮:

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