You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Sean Schofield <se...@gmail.com> on 2005/11/21 20:48:46 UTC

[shale] Value binding expressions and immediate = true

In my Shale dialog I a single required field called foo.  There is
also a command link with an action listner (no action method binding.)
 The command link has the immediate attribute set to true (its only
purpose is to empty the foo component.

When I click the link the action listener resets the value of the foo
field using the setValue method of AbstractFacesBean.  Everything
works as expected (no nagging about the foo field being required.)  On
the second click, the page complains that the field is required.  For
some reason JSF is ignoring the immediate property.  (This is with
MyFaces btw, but I assume it is also a problem in the RI.)

Any idea what could be causing this?  I was thinking it could be
related to one of the existing issues regarding command link and
navigation handler but this is not an action method just a listener.

TIA,

sean

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [shale] Value binding expressions and immediate = true

Posted by Sean Schofield <se...@gmail.com>.
[snip]

> * When an immediate action (not actionListener) is used, the JSF runtime
> calls FacesContext.responseComplete() to bypass validations and
> model updates. That doesn't happen with an action listener unless you
> do it for yourself.

I was not aware of the distinction.  That explains why it doesn't work
on the second click but it just shifts the problem to an unxpected
result on the first click.  I will try your suggestion of simplifying
the example to see what is going on.  It might be a subtle bug in the
MyFaces implementation.

> Craig

Thanks,
sean

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [shale] Value binding expressions and immediate = true

Posted by Craig McClanahan <cr...@apache.org>.
On 11/21/05, Sean Schofield <se...@gmail.com> wrote:
>
> In my Shale dialog I a single required field called foo. There is
> also a command link with an action listner (no action method binding.)
> The command link has the immediate attribute set to true (its only
> purpose is to empty the foo component.
>
> When I click the link the action listener resets the value of the foo
> field using the setValue method of AbstractFacesBean. Everything
> works as expected (no nagging about the foo field being required.) On
> the second click, the page complains that the field is required. For
> some reason JSF is ignoring the immediate property. (This is with
> MyFaces btw, but I assume it is also a problem in the RI.)
>
> Any idea what could be causing this? I was thinking it could be
> related to one of the existing issues regarding command link and
> navigation handler but this is not an action method just a listener.


It would probably help to simplify the scenario in trying to track this
down, by seeing if it happens without dialogs or AbstractFacesBean involved
-- you can emulate what setValue() does by just cut n pasting the logic from
that class. Nothing obvious from your description stands out to explain why
it's failing for you -- except for a couple of possibly related issues:

* When an immediate action (not actionListener) is used, the JSF runtime
calls FacesContext.responseComplete() to bypass validations and
model updates. That doesn't happen with an action listener unless you
do it for yourself.

* Enforcing the "required" validation checks the *submitted* value,
not the *current* value ... you might need to tweak that property instead.

Craig


TIA,
>
> sean
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>