1Z0-900 · Question #35
On your JSF page, you have a form in which you have a command button: A user submits the form by clicking the button, and no errors occur while processing the request. Which statement is true?
The correct answer is B. The listenCarefully() method is executed followed by the actNow() method. In JSF, when a commandButton has both an actionListener attribute (pointing to listenCarefully()) and an action attribute (pointing to actNow()), the JSF lifecycle guarantees that action listeners always fire before the action method - making B correct. This is by design…
Question
On your JSF page, you have a form in which you have a command button:
A user submits the form by clicking the button, and no errors occur while processing the request. Which statement is true?
Options
- AThe actNow() and ListenCarefully() methods are executed in parallel.
- BThe listenCarefully() method is executed followed by the actNow() method.
- CThe actNow() method controls the condition upon which the listenCarefully() method is allowed to
- DThe actNow method is executed followed by the listenCarefully() method.
How the community answered
(21 responses)- A10% (2)
- B86% (18)
- C5% (1)
Explanation
In JSF, when a commandButton has both an actionListener attribute (pointing to listenCarefully()) and an action attribute (pointing to actNow()), the JSF lifecycle guarantees that action listeners always fire before the action method - making B correct. This is by design: listeners are meant to intercept and pre-process the event before the main business logic executes.
A is wrong because JSF request processing is strictly sequential - nothing runs in parallel within a single lifecycle. D is wrong because it reverses the actual order; the action method is always last. C is wrong because actNow() (the action) does not gate or condition the execution of listenCarefully() (the listener) - the listener runs unconditionally first regardless of what the action does.
Memory tip: Think "Listen before you Act" - actionListener → action, always in that order.
Topics
Community Discussion
No community discussion yet for this question.