You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Broekelmann, Mathias" <MB...@PSI.DE> on 2005/05/30 15:09:15 UTC

Why HtmlDataTablePhaseListener?

Hi,

The x:datatable component uses a phase listener
(HtmlDataTablePhaseListener) for validation issues. I don't know why
this is necessary but it causes problems when a aliased bean (through
aliasbean component) is used in a nested datatable.

Due to the implementation of the aliasbean component the aliased bean is
only available in the process phases but not in the before or after
phase in which the phase listener is called. 

To solve this problem for our application I just commented the phase
listener out of faces-config.xml. The application is still working as
expected but I want to make sure that there is no hidden issue which I
haven't seen so far.

Does anyone know why this phase listener is necessary?

Mathias

Re: Why HtmlDataTablePhaseListener?

Posted by Sylvain Vieujot <sv...@apache.org>.
I'm not 100% sure I fully understand how this works for the
HtmlDataTable, but if I'm right, the only solution would be to also have
a phaseListener for the alias bean.

This would still raise some other problems :

1) A performance issue

2) I'm not sure we could set/remove the aliases in a reliable manner in
the phase listener as we have no way to know the enclosing tags.

My suggestion is to rather avoid such cases :-(

Maybe there is a better solution though ??

Sylvain.

On Mon, 2005-05-30 at 16:12 +0200, Manfred Geiler wrote:

> Yes, I (the author of this class ;-) know that this phase listener is
> absolutely necessary for the extended data table to work properly.
> This listeners purpose is to make sure that the refresh method for
> each extended HtmlDataTable in the component tree is called right
> before the render phase begins.
> There is no way to make this sure other than by means of this phase
> listener, because the render phase can be initiated by different
> incidents (see Lifecycle).
> 
> Now, why is the refresh method important?
> The refresh method clears the internal DataModel of the HtmlDataTable
> when all children are valid and therefore there is no need to longer
> preserve the DataModel. What is more, we even must omit the internal
> DataModel, so that the actual data from the backing bean is taken
> during rendering - could have been changed in the meantime by some
> application event.
> 
> Seems like this is rather an aliasbean issue. Sylvain, are you listening?
> 
> -Manfred
> 
> 
> 2005/5/30, Broekelmann, Mathias <MB...@psi.de>:
> > Hi,
> > 
> > The x:datatable component uses a phase listener
> > (HtmlDataTablePhaseListener) for validation issues. I don't know why
> > this is necessary but it causes problems when a aliased bean (through
> > aliasbean component) is used in a nested datatable.
> > 
> > Due to the implementation of the aliasbean component the aliased bean is
> > only available in the process phases but not in the before or after
> > phase in which the phase listener is called.
> > 
> > To solve this problem for our application I just commented the phase
> > listener out of faces-config.xml. The application is still working as
> > expected but I want to make sure that there is no hidden issue which I
> > haven't seen so far.
> > 
> > Does anyone know why this phase listener is necessary?
> > 
> > Mathias
> >

Re: Why HtmlDataTablePhaseListener?

Posted by Manfred Geiler <ma...@gmail.com>.
Yes, I (the author of this class ;-) know that this phase listener is
absolutely necessary for the extended data table to work properly.
This listeners purpose is to make sure that the refresh method for
each extended HtmlDataTable in the component tree is called right
before the render phase begins.
There is no way to make this sure other than by means of this phase
listener, because the render phase can be initiated by different
incidents (see Lifecycle).

Now, why is the refresh method important?
The refresh method clears the internal DataModel of the HtmlDataTable
when all children are valid and therefore there is no need to longer
preserve the DataModel. What is more, we even must omit the internal
DataModel, so that the actual data from the backing bean is taken
during rendering - could have been changed in the meantime by some
application event.

Seems like this is rather an aliasbean issue. Sylvain, are you listening?

-Manfred


2005/5/30, Broekelmann, Mathias <MB...@psi.de>:
> Hi,
> 
> The x:datatable component uses a phase listener
> (HtmlDataTablePhaseListener) for validation issues. I don't know why
> this is necessary but it causes problems when a aliased bean (through
> aliasbean component) is used in a nested datatable.
> 
> Due to the implementation of the aliasbean component the aliased bean is
> only available in the process phases but not in the before or after
> phase in which the phase listener is called.
> 
> To solve this problem for our application I just commented the phase
> listener out of faces-config.xml. The application is still working as
> expected but I want to make sure that there is no hidden issue which I
> haven't seen so far.
> 
> Does anyone know why this phase listener is necessary?
> 
> Mathias
>