local phaseListener not invoked by p:commandButton

UI Components for JSF
Post Reply
Martin Ahrer
Posts: 13
Joined: 24 Oct 2009, 19:28

20 May 2010, 11:04

I have a view with a local phase listener that is not invoked after a submit is performed with p:commandButton. What is the procedure to get that to work with primefaces ?

In general it looks like the RenderResponsePhase is not invoking the execute method since shouldSkip detects that it should not execute. This is because the org.primefaces.application.PrimeFacesPhaseListener is setting responseComplete=true.

I have compared that with the JSF2 built-in AJAX features where this works, the phase listener is invoked.

Code: Select all

	<f:phaseListener binding="#{debugPhaseListener}" />
	<p:outputPanel id="panel" />
	<h:form id="form">
		<h:commandButton value="Full" />

		<p:commandButton value="Partial Prime" update=":panel" />
		<h:commandButton value="Partial JSF" id="button3">
			<f:ajax render=":panel" />
		</h:commandButton>
	</h:form>
Summarizing, global phase listeners (defined in faces-context.xml) are executed always but local phase listeners are not.

I'm using JSF 2.0.2 + primefaces 2.0.1
JSF 2.0.4, PrimeFaces 2.2.1, Tomcat 6 (as of 2011-03-01)

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

24 May 2010, 15:48

Hi Martin,

Yes, PFPhaseListener set responseComplete to true not to invoke the actual renderresponse phase.

I'm not sure why local phaselistener is not executed though. I need to check the source of lifecycle executor in jsf implementation. Are you using mojarra 2.0.2?

Martin Ahrer
Posts: 13
Joined: 24 Oct 2009, 19:28

25 May 2010, 16:30

Yes it's the JSF RI 2.0.2 I'm using. I'd like to give you a pointer: Phase.class (RenderResponsePhase instance), line 100 (method doPhase) is detecting the responseComplete state. Pure RI Ajax is invoking the following phase.execute(context) whereas a prime faces request is ended here!

Code: Select all

        try {
            handleBeforePhase(context, listeners, event);
            if (!shouldSkip(context)) {
                execute(context);
            }
        } catch (Throwable e) {
With Pure RI then FaceletViewHandlingStrategy is invoking the phase listeners in its renderView() method. With prime faces that never gets invoked due to the responseComplete state.
JSF 2.0.4, PrimeFaces 2.2.1, Tomcat 6 (as of 2011-03-01)

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

28 May 2010, 11:32

Ok now I see, I think I will leave it as it is for now since it'll be resolved eventually when we migrate to jsf 2 ajax for PPR.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 41 guests