View RSS Feed

JSF

JSF Events Handling

Rate this Entry
by
JSF
, 01-02-2012 at 06:48 PM (1228 Views)
JSF components trigger events and these events are process by the JSF application. User generates these events by interacting with the application. For example, Click a button event is generated and triggered by the user. Programmer is responsible to handle all such events in code. You can write event listeners for this purpose.

Following JSF code is written to create a button.

Java Code: This is example of a JSF Button
<h:commandButton value="Login“
actionListener=“#{customer.loginActionListener}”
action=“#{customer.login}” />
An event listener is written in the Customer class as follows:

Java Code: JSF Event listener
class Customer { 
public void loginActionListener(ActionEvent e) {
…………………
} 
public String login() {
return “OK”;
} 
}

Submit "JSF Events Handling" to Facebook Submit "JSF Events Handling" to Digg Submit "JSF Events Handling" to del.icio.us Submit "JSF Events Handling" to StumbleUpon Submit "JSF Events Handling" to Google

Updated 01-14-2012 at 06:28 PM by JSF

Categories
Event

Comments