jsf - trying to add an actionlistener -
im trying add actionlistener menuitem primefaces component
itemlogout.addactionlistener(new actionlistenermanagedbean());
and in actionlistenermanagedbean use :
public class actionlistenermanagedbean implements actionlistener { public actionlistenermanagedbean() { super(); } @override public void processaction(actionevent arg0) throws abortprocessingexception { system.out.println("test action listener called.."); } public void actionperformed(actionevent e) { if(e.getsource() == "aa"){ } } }
but not happens when click on logout item menu.
would me please ? in advance...
your e.getsource() == "aa"
should e.getsource() == itemlogout
.
basically e.getsource()
returns object action invoked on.
i assuming actionlistenermanagedbean inner class.