[jsr-314-open-mirror] [jsr-314-open] [2.1 Spec Review] Pre/PostValidateEvent publishing conditions

David Geary clarity.training at gmail.com
Thu Oct 21 11:55:15 EDT 2010


2010/10/19 Leonardo Uribe <lu4242 at gmail.com>

> Hi
>
> 2010/10/19 Andy Schwartz <andy.schwartz at oracle.com>
>
> The following text was added to the Pre/PostValdiateEvent API doc:
>>
>> When an instance of this event is passed to
>>> SystemEventListener.processEvent(javax.faces.event.SystemEvent) or
>>> ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent),
>>> the listener implementation may assume that the source of this event
>>> instance is the UIComponent instance that is that has just been validated.
>>>
>>> Note that iterating components such as UIData, and form components such
>>> as UIForm must publish this event after processing their children nodes in
>>> UIComponent.processValidators(javax.faces.context.FacesContext).
>>>
>>
>> Does this mean that only input, UIData and UIForm components will deliver
>> these events?
>>
>>
> I was not aware that UIData deliver these events. In my understanding it
> has sense to UIForm deliver these events, because it is the container of
> UIInput components, but why UIData?
>

The only reason I can think of is that UIData is also (potentially, anyway)
a container of inputs. But so are panels, and they, evidently, are excluded.
Why?


>
>> If so, some concerns about this:
>>
>> 1.  Mojarra 2.0 delivered these events for all components.
>> 2.  The Mojarra trunk still does this (see
>> UIComponentBase.processValidators()).
>> 3.  This prevents mutti-component validation where a listener is
>> registered on an arbitrary ancestor component.
>>
>> For an example of #3, see the "Multi-Component Validation" section of Core
>> JavaServer Faces, 3rd ed:
>>
>>
>> http://my.safaribooksonline.com/9780137013968/331#X2ludGVybmFsX0ZsYXNoUmVhZGVyP3htbGlkPTk3ODAxMzcwMTM5NjgvMzMx
>>
>> Note that the PostValidateEvent listener is registered on an h:panelGrid.
>>  With the new addition to the specification, it seems that this is no longer
>> supported.
>
>
>>
> Yes, that code does not going to work.
>

At first this made sense to me: only inputs, which are the only components
that need to be validated, should fire pre/post validate events. However,
looking at mojarra, we invoke processValidations() for every component,
regardless of whether it’s an input or not.

It seems to that if we are going to call processValidations() on a
component, we should fire the associated events.


david



>
> Leonar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20101021/5796e7b6/attachment-0002.html 


More information about the jsr-314-open-mirror mailing list