users@javaserverfaces.java.net

Re: immediate on command component renders response

From: Roger Kitain <Roger.Kitain_at_Sun.COM>
Date: Thu, 13 Apr 2006 14:31:15 -0400

As you've discovered, the immediate attribute can be tricky if not used
properly.
In your small example, it is unlikely that you would want your default
actionListener
to be called before validation anyway.. However, if you add
"immediate=true" to
inputText component as well, then you should get the ValueChangeListener
execution as well.

-roger

Michael Youngstrom wrote:

>I feel I have a pretty good grasp on things in JSF and then suddenly
>some functionality throws me for a loop.
>
>The latest loop I've been thrown is that apparently when immediate is
>set on a UICommand component then after ApplyRequestValues all other
>phases are automatically short circuited.
>
>Given the following example:
>
> <h:form>
> <h:inputText valueChangeListener="#{test.validate}"
>value="#{test.stringValue}"/>
> <h:commandButton value="Immediate" immediate="true"/>
> </h:form>
>
>If I input some values into the inputText then click the button
>"Immediate" #{test.validate} is never called. This happens because
>com.sun.faces.application.ActionListenerImpl is being called which
>calls context.renderResponse().
>
>For some reason I always thought that an immediate ActionEvent would
>only short circuit the rest of the phases if a user specific
>actionListener associated with the component called renderResponse().
>Am I wrong or is this a bug?
>
>Granted I cannot think of many cases where an immediate button press
>would not want to render the response right away it just caught me off
>guard.
>
>Mike
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
>For additional commands, e-mail: users-help_at_javaserverfaces.dev.java.net
>
>
>