Clarification: There is a dataTable component in the JSF page. The getRowCount() method goes to the database to get the latest count of rows.

The snippet from JSF page is:

...
<h:dataTable id="channelData" value="#{findChannelBean.channelModel}" var="rowVar" first="0" rows="10" border="0" headerClass="findChannel_headerClass" columnClasses="findChannel_name, findChannel_description" width="600px" rendered="#{findChannelBean.showChannelDataTable}">
...

When my JSF page does not contain a dataTable session opening and closing work as expected.
Let me know if you need more info.

- Umesh

From: "Umesh Kanitkar" <[EMAIL PROTECTED]>
Reply-To: "MyFaces Discussion" <[email protected]>
To: [email protected]
Subject: afterPhase method in the PhaseListener gets called before rendering is complete
Date: Tue, 14 Feb 2006 04:41:12 +0000

Hi,

I notice that afterPhase method in the PhaseListener included in this email is exceuted before the Rendering is completed. During rendering the JSF view acceces the model which in turn accecces the database. In order to access the database a new DB session is created, thus defeating the purpose of having a DBUtil.closeSession() in the afterPhase method.

Is this correct behaviour? Is it likely that something is wrong with my configuration?


-Umesh
(Code attached below)

-----------------------------------x-------------------------

package com.ebay.channel.phaselisteners;

import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;

import com.ebay.db.DbUtil;

public class SessionClosePhaseListener implements PhaseListener {

        public void beforePhase(PhaseEvent event) {

        }

        public void afterPhase(PhaseEvent event) {

                DbUtil.closeSession();
        }

        public PhaseId getPhaseId() {

                return PhaseId.RENDER_RESPONSE;
        }

}




Reply via email to