How can I display a message through multiple sessions? JSF 2.1 & Primefaces 3.1 -


i have application shows data in p:datatable.... table accessible many users. when 1 user modify record in table, (create, edit, delete), action notified @applicationscoped managedbean notify other session (opened other users), items in table changed, must reload database. can see controller notify session items changed,

/**  * @author simone rondelli  */ @managedbean(name="singleton") @applicationscoped public class singletonbean {      private int count;     private hashmap<class, list<abstractcontroller>> sessions;      public singletonbean() {         sessions = new hashmap<class, list<abstractcontroller>>();     }      public void addsession(abstractcontroller session, class c) {         list<abstractcontroller> sessionlist = sessions.get(c);         if(sessionlist == null)             sessionlist = new arraylist<abstractcontroller>();          sessionlist.add(session);         sessions.put(c, sessionlist);     }      public void notifyitemschanged(class type) {         for(abstractcontroller : sessions.get(type)) {             a.preparelist();             a.addwarningmessage("attenzione record sono stati modificati!!");         }     } } 

this code in abstractcontroller "try" show message

public void addwarningmessage(string msg) {     //jsfutil.addwarningmessage(msg);     facesmessage facesmsg = new facesmessage(facesmessage.severity_warn, msg, msg);     facescontext.getcurrentinstance().addmessage(null, facesmsg); } 

if press f5, in other page, new records showed... want messages sent other sessions... code messages showed in page modify done, many time number of opened sessions... if have 3 sessions 3 users , 1 of these makes change in table, see 3 messages in page, meanwhile other users don't see anything.

  • how can send messages sessions??

i think should check primefaces push , take @ examples on there...

primepush

or can try ajax poll ajax poll

here ref' push in glassfish question


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -