webtier@glassfish.java.net

Re: [webtier] JSF2 Validation Behavior?

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

On 8/31/09 9:04 PM, Lincoln Baxter, III wrote:
> I'm using tomcat6.0.18
>
> Hmmm... is it possible that the dependency was pulled in through some
> other JAR? What classes should I look for to check for that?
You could check the packaged jars for any javax.validation classes.
>
> Is it possible that a bundled faces-config.xml could enable that
> setting? (doubtful?)
It's not configurable from there. Explicit configuration is via context
init parameters.
>
> On Mon, 2009-08-31 at 21:01 -0700, Ryan Lubke wrote:
>> 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
>>>
>>>
>>>
>>