You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rudi Steiner <ru...@googlemail.com> on 2007/03/28 14:54:04 UTC

Multiple calls of a phaselistener in the same request

Hi all,

I'm new to JSF and I'm setting up a project with myFaces and Tiles. I
had o problem with multiple DB-access in the same request, so i
googled for a phaselistener which logs something between the different
phases(RestoreView, ApplyRequestValues, ...) to see, when the DB is
accessed. I found
http://www.jsfTutorials.net/download/phaseTracker/phaseTracker.jar
which makes exactly the required job. What I'm wondering now is, that
the phaseTracker is called multiple times for each phase in one
request:

Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker beforePhas
INFO: BEFORE RENDER_RESPONSE(6)
Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker beforePhas
INFO: BEFORE RENDER_RESPONSE(6)
Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker afterPhase
INFO: AFTER RENDER_RESPONSE(6)
Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker afterPhase
INFO: AFTER RENDER_RESPONSE(6)
Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
INFO: BEFORE RESTORE_VIEW(1)
Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
INFO: BEFORE RESTORE_VIEW(1)
Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
INFO: AFTER RESTORE_VIEW(1)
Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
INFO: AFTER RESTORE_VIEW(1)
Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
INFO: BEFORE RENDER_RESPONSE(6)
Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
INFO: BEFORE RENDER_RESPONSE(6)
Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
INFO: AFTER RENDER_RESPONSE(6)
Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
INFO: AFTER RENDER_RESPONSE(6)

First i thought that something is wrong with the configuration of my
project. So I embedded the phaseTracker in the sample-tiles-app from
the myFaces website and saw, that also there the tracker is called
twice for each phase in one request.

Could anyone please tell me, why the same phaselistener is called
multiple times for one request? Has it to do with multiple <f:view/>-
and <f:subview/>-Elements in one page?

Thank you in advance,
Rudi

Re: Multiple calls of a phaselistener in the same request

Posted by Rudi Steiner <ru...@googlemail.com>.
Hi Volker,

thank you very much. I added the phaselistener in my faces-config like this

<lifecycle>
      <phase-listener>org.exadel.jsf.PhaseTracker</phase-listener>
 </lifecycle>

This setting was already included in the jar-file in
META-INF/faces-config.xml, so the facelistener was registered twice. I
didn't know that it's possible to include an extension to the
faces-config.xml in the jar-file.

Thank you,
Rudi


On 3/28/07, Volker Weber <v....@inexso.de> wrote:
> Hi Rudi,
>
> looks like the phaseListener is invoked twice.
>
> Did you anything to configure this?
> the jar contains already the configuration, if you did the same in
> yout faces-config.xml
> you will get two phaseListeners running.
>
> Regards,
>   Volker
>
> 2007/3/28, Rudi Steiner <ru...@googlemail.com>:
> > Hi all,
> >
> > I'm new to JSF and I'm setting up a project with myFaces and Tiles. I
> > had o problem with multiple DB-access in the same request, so i
> > googled for a phaselistener which logs something between the different
> > phases(RestoreView, ApplyRequestValues, ...) to see, when the DB is
> > accessed. I found
> > http://www.jsfTutorials.net/download/phaseTracker/phaseTracker.jar
> > which makes exactly the required job. What I'm wondering now is, that
> > the phaseTracker is called multiple times for each phase in one
> > request:
> >
> > Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker beforePhas
> > INFO: BEFORE RENDER_RESPONSE(6)
> > Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker beforePhas
> > INFO: BEFORE RENDER_RESPONSE(6)
> > Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker afterPhase
> > INFO: AFTER RENDER_RESPONSE(6)
> > Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker afterPhase
> > INFO: AFTER RENDER_RESPONSE(6)
> > Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
> > INFO: BEFORE RESTORE_VIEW(1)
> > Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
> > INFO: BEFORE RESTORE_VIEW(1)
> > Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
> > INFO: AFTER RESTORE_VIEW(1)
> > Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
> > INFO: AFTER RESTORE_VIEW(1)
> > Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
> > INFO: BEFORE RENDER_RESPONSE(6)
> > Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
> > INFO: BEFORE RENDER_RESPONSE(6)
> > Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
> > INFO: AFTER RENDER_RESPONSE(6)
> > Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
> > INFO: AFTER RENDER_RESPONSE(6)
> >
> > First i thought that something is wrong with the configuration of my
> > project. So I embedded the phaseTracker in the sample-tiles-app from
> > the myFaces website and saw, that also there the tracker is called
> > twice for each phase in one request.
> >
> > Could anyone please tell me, why the same phaselistener is called
> > multiple times for one request? Has it to do with multiple <f:view/>-
> > and <f:subview/>-Elements in one page?
> >
> > Thank you in advance,
> > Rudi
> >
>

Re: Multiple calls of a phaselistener in the same request

Posted by Volker Weber <v....@inexso.de>.
Hi Rudi,

looks like the phaseListener is invoked twice.

Did you anything to configure this?
the jar contains already the configuration, if you did the same in
yout faces-config.xml
you will get two phaseListeners running.

Regards,
  Volker

2007/3/28, Rudi Steiner <ru...@googlemail.com>:
> Hi all,
>
> I'm new to JSF and I'm setting up a project with myFaces and Tiles. I
> had o problem with multiple DB-access in the same request, so i
> googled for a phaselistener which logs something between the different
> phases(RestoreView, ApplyRequestValues, ...) to see, when the DB is
> accessed. I found
> http://www.jsfTutorials.net/download/phaseTracker/phaseTracker.jar
> which makes exactly the required job. What I'm wondering now is, that
> the phaseTracker is called multiple times for each phase in one
> request:
>
> Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker beforePhas
> INFO: BEFORE RENDER_RESPONSE(6)
> Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker beforePhas
> INFO: BEFORE RENDER_RESPONSE(6)
> Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker afterPhase
> INFO: AFTER RENDER_RESPONSE(6)
> Mar 28, 2007 2:30:24 PM org.exadel.jsf.PhaseTracker afterPhase
> INFO: AFTER RENDER_RESPONSE(6)
> Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
> INFO: BEFORE RESTORE_VIEW(1)
> Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
> INFO: BEFORE RESTORE_VIEW(1)
> Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
> INFO: AFTER RESTORE_VIEW(1)
> Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
> INFO: AFTER RESTORE_VIEW(1)
> Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
> INFO: BEFORE RENDER_RESPONSE(6)
> Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker beforePhas
> INFO: BEFORE RENDER_RESPONSE(6)
> Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
> INFO: AFTER RENDER_RESPONSE(6)
> Mar 28, 2007 2:30:38 PM org.exadel.jsf.PhaseTracker afterPhase
> INFO: AFTER RENDER_RESPONSE(6)
>
> First i thought that something is wrong with the configuration of my
> project. So I embedded the phaseTracker in the sample-tiles-app from
> the myFaces website and saw, that also there the tracker is called
> twice for each phase in one request.
>
> Could anyone please tell me, why the same phaselistener is called
> multiple times for one request? Has it to do with multiple <f:view/>-
> and <f:subview/>-Elements in one page?
>
> Thank you in advance,
> Rudi
>