InterviewSolution
| 1. |
What Is The Difference Between An Action And An Action Listener? |
|
Answer» Actions are designed for business logic and participate in navigation handling, whereas action listeners typically perform user INTERFACE logic and do not participate in navigation handling. Basically the "action" attribute refers to an action method which returns a String from which the Faces navigation model can use to decide whether or not a navigation is NECESSARY based on the value of the string. An actionlistener method COMPARED to an action method does not return a String. Instead it returns void. It is basically identical to the action method but instead it just executes the code after an action event (button click or link click) but a navigation is not needed. Action LISTENER is a class that wants to be notified when a COMMAND component fires an action event. Actions are designed for business logic and participate in navigation handling, whereas action listeners typically perform user interface logic and do not participate in navigation handling. Basically the "action" attribute refers to an action method which returns a String from which the Faces navigation model can use to decide whether or not a navigation is necessary based on the value of the string. An actionlistener method compared to an action method does not return a String. Instead it returns void. It is basically identical to the action method but instead it just executes the code after an action event (button click or link click) but a navigation is not needed. Action listener is a class that wants to be notified when a command component fires an action event. |
|