View RSS Feed


JSF Action Events

Rate this Entry
, 07-07-2012 at 05:54 PM (765 Views)
For UI Command objects, emission of the action events takes place. When Command button is pressed by a user or a hyper link is clicked, generation of such events take place. Number of listeners could be attached to the source. For instance, let us consider the given code:

Java Code:
<h:commandButton value = "Test Action Listener"
actionListener = "#{testActionListener.doSomeAction}" />
An attribute known as actionListener is defined that point towards the method expression. Such method expression would be resolving towards method known as doSomeAction() that has been defined in the Managed Bean along with TestActionListener.

Java Code:
public void anyMethod(ActionEvent actionEvent)
Managed Bean definition is given below in the Faces Configuration file,

XML Code:
Two listeners are attached by this given code to the component that has been made identified by the help of myComponent.

Java Code:
UIComponent myComponent = new UIComponent();
myComponent.addActionListener(new TestActionListener());
myComponent.addActionListener(new CustomActionListener());

Submit "JSF Action Events" to Facebook Submit "JSF Action Events" to Digg Submit "JSF Action Events" to Submit "JSF Action Events" to StumbleUpon Submit "JSF Action Events" to Google