O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – automatically hiding NotificationBar

In this section we will demonstrate how to display the PrimeFaces NotificationBar component and automatically hide it using the JavaScript setTimeout() function.

  1. Create a NotificationBar widget and buttons to show and hide it using the following code:
    <p:notificationBar id="bar" widgetVar="notifBar" position="top" effect="slide" effectSpeed="slow" style="height: 20px; background-color: #8B0000;"> <h:outputText value="There are New Unread Emails in your MailBox." style="color:#FFF;font-size:20px;"/> </p:notificationBar> <h:form> <p:commandButton value="Show" onclick="notifBar.show()"/> <p:commandButton value="Hide" onclick="notifBar.hide()"/> <p:commandButton value="Show &amp; Auto Hide" onclick="showNotifBar()"/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required