I have also took a look at the jsf phases in a JSF portlet application with 2
portlets on a page in Liferay. I have a phase listener in each backing bean of
the portlets implemented an anonymous class printing information at each phase
with this strucutre: <portlet-name> <faces-context-hash-code> <phase>
<bean-hash-code> <bean-class-name>
On the first invokation of the page (no user action), only the following is
done:
Navi Portlet 3775490 : Before Phase: RENDER_RESPONSE(6)
Bean: 3243465 .PDNAVBean
Navi Portlet 3775490 : After Phase: RENDER_RESPONSE(6)
Bean: 3243465 .PDNAVBean
I don't understand this, because my seconde portlet (details) is rendered also.
Now the user has clicked a link in the navi portlet which stores a session
variable which is read from details portlet:
Navi Portlet 32053749 : Before Phase: RESTORE_VIEW(1)
Bean: 3243465 .PDNAVBean
Details Portlet 32053749 : Before Phase:RESTORE_VIEW(1)
Bean: 32615754 .PDNAVDetailsBean
Details Portlet 32053749 : After Phase RESTORE_VIEW(1)
Bean: 32615754 .PDNAVDetailsBean
Navi Portlet 32053749 : After Phase: RESTORE_VIEW(1)
Bean: 3243465 .PDNAVBean
Navi Portlet 32053749 : Before Phase:
APPLY_REQUEST_VALUES(2) Bean: 3243465 .PDNAVBean
Details Portlet 32053749 : Before
Phase:APPLY_REQUEST_VALUES(2) Bean: 32615754 .PDNAVDetailsBean
Details Portlet 32053749 : After Phase
APPLY_REQUEST_VALUES(2) Bean: 32615754 .PDNAVDetailsBean
Navi Portlet 32053749 : After Phase:
APPLY_REQUEST_VALUES(2) Bean: 3243465 .PDNAVBean
Navi Portlet 32053749 : Before Phase:
PROCESS_VALIDATIONS(3) Bean: 3243465 .PDNAVBean
Details Portlet 32053749 : Before
Phase:PROCESS_VALIDATIONS(3) Bean: 32615754 .PDNAVDetailsBean
Details Portlet 32053749 : After Phase
PROCESS_VALIDATIONS(3) Bean: 32615754 .PDNAVDetailsBean
Navi Portlet 32053749 : After Phase:
PROCESS_VALIDATIONS(3) Bean: 3243465 .PDNAVBean
Navi Portlet 32053749 : Before Phase:
UPDATE_MODEL_VALUES(4) Bean: 3243465 .PDNAVBean
Details Portlet 32053749 : Before
Phase:UPDATE_MODEL_VALUES(4) Bean: 32615754 .PDNAVDetailsBean
Details Portlet 32053749 : After Phase
UPDATE_MODEL_VALUES(4) Bean: 32615754 .PDNAVDetailsBean
Navi Portlet 32053749 : After Phase:
UPDATE_MODEL_VALUES(4) Bean: 3243465 .PDNAVBean
Navi Portlet 32053749 : Before Phase:
INVOKE_APPLICATION(5) Bean: 3243465 .PDNAVBean
Details Portlet 32053749 : Before
Phase:INVOKE_APPLICATION(5) Bean: 32615754 .PDNAVDetailsBean
----- selection stored in portlet session from Navi Portlet
Details Portlet 32053749 : After Phase
INVOKE_APPLICATION(5) Bean: 32615754 .PDNAVDetailsBean
_____selection read from portlet session from Details Portlet
Navi Portlet 32053749 : After Phase:
INVOKE_APPLICATION(5) Bean: 3243465 .PDNAVBean
Navi Portlet 32053749 : Before Phase:
RENDER_RESPONSE(6) Bean: 3243465 .PDNAVBean
Details Portlet 32053749 : Before
Phase:RENDER_RESPONSE(6) Bean: 32615754 .PDNAVDetailsBean
Details Portlet 32053749 : After Phase
RENDER_RESPONSE(6) Bean: 32615754 .PDNAVDetailsBean
Navi Portlet 32053749 : After Phase:
RENDER_RESPONSE(6) Bean: 3243465 .PDNAVBean
Navi Portlet 23107587 : Before Phase:
RENDER_RESPONSE(6) Bean: 3243465 .PDNAVBean
Details Portlet 23107587 : Before
Phase:RENDER_RESPONSE(6) Bean: 32615754 .PDNAVDetailsBean
Details Portlet 23107587 : After Phase
RENDER_RESPONSE(6) Bean: 32615754 .PDNAVDetailsBean
Navi Portlet 23107587 : After Phase:
RENDER_RESPONSE(6) Bean: 3243465 .PDNAVBean
Why is the RENDER_RESPONSE phase called so often ? ..and with different
FacesContext objects ?
-----Ursprüngliche Nachricht-----
Von: Volker Weber [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 26. September 2006 22:38
An: MyFaces Discussion
Betreff: Re: PhaseListener getting called multiple times
Are you sure that the phaseListener is not more than one time configured?
Put a log statement in the Constructor to see how many instances are created.
2006/9/26, Iordanov, Borislav (GIC) <[EMAIL PROTECTED]>:
>
>
>
>
> Are you using this in portlets?
>
>
>
> ________________________________
>
>
> From: a k [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 26, 2006 4:29 PM
> To: MyFaces Discussion
> Subject: Re: PhaseListener getting called multiple times
>
>
>
>
>
> I have this in my Listener impl class:
>
> public PhaseId getPhaseId() {
> return PhaseId.RENDER_RESPONSE;
> }
>
> Not sure why it is getting called exactly 4 times. Also, there are more
> phases than 4.
>
>
>
>
> On 9/26/06, John <[EMAIL PROTECTED]> wrote:
>
>
> It sounds like it's getting called for each phase.
>
>
>
> Be sure and define a getPhaseId() so it knows what phase to pay attention
> to.
>
>
>
>
>
> public PhaseId getPhaseId() {
> return PhaseId.RESTORE_VIEW;
> }
>
>
> ________________________________
>
>
> From: a k [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 26, 2006 1:21 PM
> To: MyFaces Discussion
> Subject: PhaseListener getting called multiple times
>
>
> Hi,
>
> I followed this article to show more meaningful validation messages at the
> top of the page.
> http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk7.html
>
> What I am noticing is that the Phase Listener is getting called multiple
> times (4 to be precise) per request. So instead of getting something like
> "Field Name: Please enter a valid value." I am getting "Field Name: Field
> Name: Field Name: Field Name: Please enter a valid value."
>
> Could some one point me in the right direction?
>
> Thanks!
>
>
>
>