0

Is possible to show <p:growl> notifications on new entry in database table using JSF? I want the growl notifications to fire whenever a user submits an entry to the status table, or comments table.

  • what is adding the entry to the database table? are you talking about data entered outside of the JSF app? by another user of the same app? some scheduled service? – Lucas Mar 29 '13 at 16:32
  • I am talking about being data entered by any user using an xhtml page in the same JSF app, an user enters the data by submitting the `` –  Mar 29 '13 at 16:38
  • What have you tried? `` simply shows any `FacesMessage`'s you have added to your response: http://www.primefaces.org/showcase/ui/growl.jsf . So if you add a message in the action method you are using to create new entries in your database, then add the `` component, your messages will be displayed... – Lucas Mar 29 '13 at 16:42
  • I want the `FaceMessage`s to get added to the response whenever there is any change in status table of the database. I have tried checking the database whenever the page loads and adding the`FacesMessage`s if there is any new entry int the status table but it would have been really better if `FacesMessage`s got added when there is any change in status table automatically –  Mar 29 '13 at 16:46
  • AkselWillgert is right with the PrimeFaces Push option, but your requirement seems a bit odd. Are you aware the impact of this, specially if these tables are highly used for insert operations (looks like comments table is)? – Luiggi Mendoza Mar 29 '13 at 18:03
  • @LuiggiMendoza Actually what I want to achieve is what facebook does. Facebook automatically generates a growl whenever there is a status update. I know facebook is designed using php but how does they do it? –  Mar 29 '13 at 18:29

1 Answers1

1

The DataTable cell edit showcase has some example that displays a growl for the user editing a table here

If you want the growl to be displayed for all users when one users add some data, look into primefaces push:

Primefaces-Push message showcase

if you decide to go for push, I'd would recomend with just setting up some basic example, without incorporating it into your current application right away.

Aksel Willgert
  • 11,367
  • 5
  • 53
  • 74