dev@javaserverfaces.java.net

Re: jsf immediate on action

From: richard ratta <Richard.Ratta_at_Sun.COM>
Date: Mon, 25 Jun 2007 20:45:51 -0400

"Immediate" on UICommand results in a couple of behaviors.

An ActionEvent is broadcast based on the value of its phaseId.
For an immediate UICommand (Button) that phase id is set to
"APPLY_REQUEST_VALUES"
when the UICommand is immediate.
This means the event will be broadcast before "PROCESS_VALIDATIONS"
phase begins. Otherwise the event is broadcast after "INVOKE_APPLICATION".

In the immediate case, the lifecycle will terminate before
"PROCESS_VALIDATIONS"
and go directly to RENDER_RESPONSE. This happens by way of the default
default ApplicationActionListener. I believe this is "spec'd" by the
definition of an "ActionSource".

If the UICommand is not immediate then the lifecycle completes since
INVOKE_APPLICATION
is effectively the end of the lifecycle, since the next phase is
RENDER_RESPONSE.

Now any subclass of UICommand or any parent in the chain of "queueEvent" can
change the phase id of the ActionEvent that is bubbling up to the view root.

Our Button extends UICommand and I believe chose to follow the behavior of
UICommand and the behavior inherent in an ActionSource, which causes
the default ApplicationActionListener to be invoked.


-rick

Dmitry Kushner wrote:

> wrt https://woodstock.dev.java.net/issues/show_bug.cgi?id=84:
>
> The reported issue deals with button that submits the form and the
> text field, where button's immediate == true
>
> I have traced the lifecycle processing within LifecycleImpl.execute,
> and when immediate is true, it requests lifecycle processing to go to
> Render_Response ( context.getRenderResponse() == true, line 108)
>
> Why immediate flag on the button completes the lifecycle processing
> ? JSF specification says any component *can *do that, but it does not
> specify that action *does or must *complete lifecycle processing? I
> could not find anywhere in the specification where such behavior is
> described as prescribed....
>
> --
>
> thank you ,
> ~ dmitry
>