webtier@glassfish.java.net

Re: [webtier] JSF2 Validation Behavior?

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Mon, 31 Aug 2009 21:01:28 -0700

On 8/31/09 8:59 PM, Jason Lee wrote:
> What's your container? GlassFish, for example, bundles BV, iirc.
> Ryan, does GF pick that up automatically?
Beans validation is part of V3, so if you're using V3, this option is
enabled.
>
> On Aug 31, 2009, at 10:53 PM, Lincoln Baxter, III wrote:
>
>> Nope, neither beans validation API nor
>> javax.faces.VALIDATE_EMPTY_FIELDS are present in my application, yet
>> my validators are being called (checked via step debugging.) I'll
>> file an issue for this:
>>
>> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=623
>>
>> I'm using 2.0.0-b16
>>
>> <h:inputSecret id="oldpassword" required="false">
>> <f:validator validatorId="currentUserPasswordValidator" />
>> </h:inputSecret>
>>
>> <h:inputSecret id="password" required="false"
>> value="#{userProfileBean.newPassword}">
>> <f:validator validatorId="passwordValidator" />
>> </h:inputSecret>
>>
>> <h:inputSecret id="passwordConfirm" required="false">
>> <f:validator validatorId="passwordValidator" />
>> </h:inputSecret>
>>
>>
>>
>>
>> On Mon, 2009-08-31 at 08:31 -0700, Ryan Lubke wrote:
>>> On 8/30/09 11:11 AM, Lincoln Baxter, III wrote:
>>>> If I am remembering correctly, validators do not fire for empty
>>>> fields on form submission. I'm currently seeing behavior in the
>>>> latest snapshot where validators are indeed firing on empty fields.
>>>>
>>>> Is this intended? I seem to recall discussion about this some time
>>>> ago, but can't find it.
>>>>
>>>> Is there a behavior toggle switch? What am I missing?
>>> There's a context init parameter called
>>> 'javax.faces.VALIDATE_EMPTY_FIELDS'.
>>> The value will default to false *unless* the Beans Validation API is
>>> present in which case the value will be set to true (if not
>>> already explicitly set).
>>>
>>> See UIInput#valdiateValue(FacesContext,Object) for details.
>>>>
>>>> --Thanks,
>>>> Lincoln
>>>
>
> <http://www.java.com> * Jason Lee *
> Senior Java Developer
> GlassFish Administration Console
>
> *Sun Microsystems, Inc.*
> Phone x31197/+1 405-343-1964
> Email jasondlee_at_sun.com <mailto:jasondlee_at_sun.com>
> Blog http://blogs.sun.com/jasondlee
> Blog http://blogs.steeplesoft.com
>
>