You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Ole Ersoy <ol...@yahoo.com> on 2006/01/24 23:55:42 UTC
LifecycleBug?
Hey Everybody,
I'm using myfaces 1.1.1.
I wrote a PhaseListener and it works fine the PhaseId
is set to RESTORE_VIEW, however any other PhaseId does
not work.
Has anyone else experienced something similar?
Thanks,
- Ole
Here's the code:
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import javax.faces.application.Application;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
public class HTMLTableTreeViewerAjaxPhaseListener
implements PhaseListener {
private static Logger theLogger =
Logger.getLogger(Mock.class.getName());
public PhaseId getPhaseId() {
return PhaseId.APPLY_REQUEST_VALUES;
}
public void afterPhase(PhaseEvent e) {
theLogger.info("KICKING IN THE BEFORE PHASE!");
}
public void beforePhase(PhaseEvent e) {
theLogger.info("KICKING IN THE AFTER PHASE!");
}
}
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: LifecycleBug?
Posted by Simon Kitching <sk...@apache.org>.
On Tue, 2006-01-24 at 14:55 -0800, Ole Ersoy wrote:
> Hey Everybody,
>
> I'm using myfaces 1.1.1.
>
> I wrote a PhaseListener and it works fine the PhaseId
> is set to RESTORE_VIEW, however any other PhaseId does
> not work.
>
> Has anyone else experienced something similar?
When a page is viewed for the first time, the RESTORE_VIEW phase
executes then processing immediately leaps to the RENDER phase, because
there is nothing for the other phases to do.
So APPLY_VALUES phase listeners will only be invoked when a page is
being "submitted", ie when some command link is clicked in the page, not
when the page is being displayed for the first time.
I suggest you change your getPhaseId to return PhaseId.ANY_PHASE and see
what callbacks you get. You should see restore+render for the first page
view, restore+apply+render for pages where validation fails, restore
+apply+render when an immediate command component is clicked, and the
full set of callbacks otherwise.
Regards,
Simon