dev@javaserverfaces.java.net

Re: jsf immediate on action

From: richard ratta <Richard.Ratta_at_Sun.COM>
Date: Mon, 25 Jun 2007 21:24:48 -0400

See section 7.1.1

-rick

Dmitry Kushner wrote:

>
>
> richard ratta wrote:
>
>> "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.
>
> yes, I can see all this in the JSF code. I just do not see /where /in
> the spec such behavior is specified. I see events, which phase is
> used in immediate or other case, but I do not see where it says that
> such event should interrupt the cycle...( they may, but the way I read
> this is more for specializations of reference implementation, not for
> RI itself.) I must be missing something here...
>
>>
>> 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.
>>
> in ActionSource docs for /isImmediate() /i read: "Return a flag
> indicating that the default |ActionListener|
> <imap://rratta_at_bur-mail2.east.sun.com:993/fetch%3EUID%3E/INBOX%3E37250?header=quotebody&part=1.2&filename=ActionListener.html>
> provided by the JavaServer Faces implementation should be executed
> immediately (that is, during /Apply Request Values/ phase of the
> request processing lifecycle), rather than waiting until the /Invoke
> Application/ phase."
> no mention that cycle is ended there.


>
> TLD docs for webui.Button are somewhat more confusing:


> " A button that is used to affect the input components on the page,
> such as providing initial default input, should be configured with
> |immediate="true"| and ..."If you want a button to submit a page, you
> should not set |immediate|,"


>>
>> -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
>>>
>
> --
>
> thank you ,
> ~ dmitry
>