Phase Listener in Subsystem deployed as BTF in Master - jdev 11.1.2.3

Hello:
We are using Subsystems with BTF's that are deployed as ADFLibs. These Subsystem ADFLibs are imported into a Master app and the BTF's are used as a region in the Master.
I tried to create Phase Listener that displays System.out.println msgs in the Subsystem that was then used as a region in the Master app.
But no messages from the Phase Listener appear on the console. What am I missing? Would the Phase Listeners have to be in the Master app?
What if I wanted the Phase Listener of just the subsystem? Is this possible?
Below is the code for adf-settings.xml and java class that implements PagePhaseListener:
<?xml version="1.0" encoding="UTF-8" ?>
<adf-config xmlns="http://xmlns.oracle.com/adf/config">
<adfc-controller-config xmlns="http://xmlns.oracle.com/adf/controller/config">
<lifecycle>
<phase-listener>
<listener-id>myListener</listener-id>
<class>com.xxxx.labs.madison.ptnr.phase.listener.MyPagePhaseListener</class>
</phase-listener>
</lifecycle>
</adfc-controller-config>
</adf-config>
package com.xxxx.labs.madison.ptnr.phase.listener;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import oracle.adf.controller.v2.lifecycle.Lifecycle;
import oracle.adf.controller.v2.lifecycle.PagePhaseEvent;
import oracle.adf.controller.v2.lifecycle.PagePhaseListener;
public class MyPagePhaseListener implements PagePhaseListener {
public MyPagePhaseListener() {
super();
public void afterPhase(PagePhaseEvent pagePhaseEvent) {
System.out.println("inside afterPhase="+pagePhaseEvent.getPhaseId());
System.out.println("getDebugValue="+pagePhaseEvent.getDebugValue());
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
System.out.println("Lifecycle.PREPARE_RENDER_ID="+pagePhaseEvent.getDebugValue());
FacesContext fctx = FacesContext.getCurrentInstance();
String viewId = fctx.getViewRoot().getViewId();
FacesMessage message = new FacesMessage("Hello Page no " + viewId);
fctx.addMessage(null, message);
public void beforePhase(PagePhaseEvent pagePhaseEvent) {
System.out.println("inside beforePhase="+pagePhaseEvent.getPhaseId());
System.out.println("getDebugValue="+pagePhaseEvent.getDebugValue());
}

First, ensure the phase listener is working in the subsystem app.
Second, after the master app consumes the child app (as adflib), define the phase listener in the web.xml (within the masterapp).
face-config and taskflow config files are combined but i dont think its the same case for web.xml.

Similar Messages

  • Phase Listener buries exceptions

    This is a JSF question sort of...
    Can anybody hazard a guess why my JSF Phase Listener does not show exceptions when one gets thrown in a method within this PhaseListener?
    I am using ADF/BC and JSF/ADF Faces within JDeveloper 10.1.3.4 and deploying to iAS 10.1.3.4.
    I have not tried the same thing in an ADFPhaseListener...chiefly because I wanted a beforePhase() and an afterPhase() method to override, and Source-->Override Methods did not show these methods as being overrideable...so I just used the normal JSF Phase Listener.
    My theory is that PhaseListener is perhaps accessed by many sessions?? So it has no way to know to where its stack traces should be directed. So I guess I should use logging with some sort of general catch clause for each method...any ideas will be entertained.
    Thanks in advance.

    Here's exactly what it says:
    The beforePhase() method is called before the standard processing for a particular phase is
    performed, while the afterPhase() method is called after the standard processing has been
    completed. The JSF implementation must guarantee that, if beforePhase() has been
    called on a particular instance, then afterPhase() will also be called, regardless of any
    Exceptions that may have been thrown during the actual execution of the lifecycle phase. For
    example, let’s say there are three PhaseListeners attached to the lifecycle: A, B, and C, in
    that order. A.beforePhase() is called, and executes successfully. B.beforePhase()
    is called and throws an exception. Any exceptions thrown during the beforePhase()
    listeners must be caught, logged, and swallowed. In this example, C.beforePhase()
    must not be called. Then the actual lifecycle phase executes. Any exceptions thrown during
    the execution of the actual phase must not be swallowed. When the lifecycle phase exits, due
    to an exeception or normal termination, the afterPhase() listeners must be called in
    reverse order from the beforePhase() listeners in the following manner.
    C.afterPhase() must not be called, since C.beforePhase() was not called.
    B.afterPhase() must not be called, since B.beforePhase() did not execute
    successfully. A.afterPhase() must be called. Any exceptions thrown during the afterPhase()
    listeners must be caught, logged, and swallowedJohn

  • ADF:How to use NavigationHandler in Phase-Listener with adfc-config.xml

    Hi,
    in our application a user should be navigated to the login-page, when he tries to navigate directly to a page where he has no right for or if the session is expired.
    Our navigation is complete in the adfc-config.xml. So I created a phase-listener, which is called by the adf-settings.xml.
    Inside the phase-listener I'm checking the rights. If the user doesn't have the needed rights, he should be linked to the login page. But how can I do that?
    Some days ago our navigation has been complete in the faces-config.xml. But now we moved the navigation to the adfc-config.xml, because we are sure that it's better. E.g. for using the dialog framework.
    In the face-config.xml we had also the call of the phase-listener. There we did the forwarding like this and it worked:
    FacesContext facesContext = FacesContext.getCurrentInstance();
    facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, null, "login_page");But now I think I have to use the ADFContext somehow, or?
    So how can I do that with the adfc-config.xml?
    Thanks a lot for your help,
    Bastian
    I'm using JDeveloper 11g Release 1 (11.1.1.3.0)

    Hello Frank,
    thanks for your answer, but it doesn't really help me, because I'm a newbie, sorry.
    Does your answer mean, that I should leave the call of the phase-listener in the faces-config and then I would also have access to the login-page, which is in the adfc-config?
    Or does it mean, that I call now my phase-listener by adf-settings but don't have to change the phase-listener itself and can still use my code (FacesContext...)? But that's not working. I get no error but he is also not redirecting.
    Maybe my problem starts on an earlier point.
    Is it better to create all pages in the adfc-config or faces-config? (Maybe you have a good reference for reading about such a basic discussion)
    I thought adfc-config would be the better one. But there I'm not able to redirect to another page (login) if somebody calls a special page without rights for example.
    So my second basic question would be about the relation of adfc-config, faces-config and ADFContext and FacesContext.
    Because I think it's not a short answer I hope you could give me also for this a reference so that I can read these basics myself.
    Thanks a lot for helping a newbie becoming better :-)
    Bastian

  • How do I set a Phase Listener to only run for a specific page?

    How do I set a Phase Listener to only run for a specific page?
    I understand that a Phase Listener runs for ever page in the application, however I want a phase listener to only run for one page at the beginning of the application.
    I discovered I can't use a Filter, because the JSF Application instance always returns null.
    Thus, I thought a Phase Listener would be a good approach.
    Thoughts?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I have moved forward with checking the requested URI...
    (shivers)
    Thanks,
    --Todd                                                                                                                                                                                   

  • Hi how to use phase listener in jsf

    hi
    i have a scenariao were the data have to fetched form database before the page gets loaded . so i came abt phase listeners . so can anybody give some example for phase listener.....
    thanks

    This is just basic Java knowledge, but anyway ..public class SomeClass {
        static {
            // static initialization block, this is executed only once per runtime, before the first instantiation.
            // Initialization block, this is executed before the constructor on every instantiation.
        public SomeClass() {
            // the constructor, this is executed on every instantiation.
    }

  • Popup + before phase listener + commandlink issue

    All,
    I have a before phase listener configured on a page to open a popup and it works pretty well i.e. the popup gets opened when the page is loaded. Now i want to show the same popup when the user clicks on the commandLink. So i configured the commandLink to have a showPopupbehaviour as its child. The issue is when i click on the command link the popup is not getting opened. However if i remove the call to the before phase listener (), the popup is getting invoked from the command link.
    Please advice whats wrong in this case ? Ideally both should be working independently.
    I tried setting the immediate and auto submit also but no effect.
    thnks
    Jdev 11.1.1.5

    Hi,
    using af:showPopupBehavior issues a request to the server, which then also is handled by your phase listener. So you need to add some logic to your phase listener to not process its action when the command button is pressed. You can e.g. set the command button to partialSubmit = true and then check if the request is a partial request AdfContext.getCurrentInstance().isPartialRequest(facesContext) This way the phase listener opens the popup when a page loades but no longer after.
    Frank

  • Trouble with Phase Listener?

    I am having a problem getting my page beans' "init", "preprocess" and "prerender" methods to fire. My page beans are inherited from "com.sun.jsfcl.app.AbstractPageBean" which do have these methods defined. From what I've found, it appears that my problem is a lack of a "phase-listener" in my faces-config.xml file. How should this be configured? If I put in:
    <lifecycle>
    <phase-listener>com.sun.jsfcl.app.AbstractPageBean</phase-listener>
    </lifecycle>
    I get an error that the phase listener can't be instantiated (which makes sense, it is abstract). How do I configure my application so that the "init", "preprocess" and "prerender" methods fire?
    Thanks,
    Lonnie

    I have absolutely no idea what you're talking about. This is not JSF specific.
    Maybe you're using some additional JSF component library which offers this stuff. I guess that it is Woodstock again. In any way, you should consult the documentation which come along with the component library for answers on this kind of questions.

  • What are the steps to define a phase listener in JSF 1.1?

    Hello everyone...
    Implementing a page listener in JSF 1.2 (the one that comes with JDeveloper 11g) is very straight forward, you implement the methods getPhaseID, beforePhase,afterPhase, and then add the class into the JSF configuration file. It works like charm.
    However, doing the same thing with JDeveloper 10.1.3.4 (it comes with JSF 1.1) never works... so I was wondering... Am I missing something? What are the correct steps to do it?
    thanks in advance.

    Dear Mr. John...
    thanks for your kind reply... however, I already was able to implement the Phase Listener successfully in JDeveloper 11g with JSF 1.2 specs. And it works just fine...
    what am I asking is that I am doing exactly the same steps under JDeveloper 10.1.3.4 under JSF 1.1 specs, but it does not work at all... so what is the problem? any idea?
    best regards

  • How to get an event programmatically from a phase listener

    Hi all,
    does anyone know how I can get the component which generated the postback from a phase listener? I need this information because, in my application, I need to log into the database all the buttons and/or options the user clicked.
    Thanks in advance,
    Monique

    Best what you can do is to get all map keys of the ExternalContext#getRequestParameterMap(), those are client ID's of the input elements involved in the form submit, then use UIViewRoot#findComponent() to get the component by client ID and finally determine if it is an instance of UICommand.

  • ADF Faces: Phase listener

    hi folks,
    In phase listener can we get which is a last action fired .I
    have command links in page with action associated with it ,in phase listener i want to know which action is fired that is which commandlink is clicked
    Thanks
    Pravin

    ok! i know for  initial requests  (when a user requesting the page for the first time ) the "JavaServer Faces implementation creates an empty view during restore View phase and the life cycle advances to the render response phase".
    so i think it is impossible to change Uicomponent state in phase listener !!!!   but how can i change Uicomponent attribute before page send to user's browser ?!!

  • Invoking an ADF Phase Listener

    Hi,
    I've created and configured an ADF Phase Listener, following Frank Nimphius's instructions from https://blogs.oracle.com/jdevotnharvest/entry/how_to_configure_an_adf_phase_listener_and_where_to_put_the_file
    But the listener code apparently never gets accessed when I'm running my application. Is there something else I need to do (other than what is mentioned in the above link) ?
    Regards,
    Andreas

    Hi Vinod,
    Thanks for your reply. It turns out that the problem was that I had managed to get adf-settings.xml and adf-config.xml mixed up because I was too tired when I wrote the code. With a proper adf-settings.xml file I can now see my listener code being accessed.
    Regards,
    Andreas

  • Ajax component, phase listener and findComponent help

    Hello,
    I have a component that issues an Ajax Request. This request is collected by a phase-listener and then processed, however I am having difficulties finding the component that I want to re-render.
    Is there a common approach for getting hold of components from a PhaseListener ? My scenario is:
    When the user clicks and drags inside my component, I want to register the X-axis drag with a ValueChangeListener. (The component has a valueChangeListener="" attribute).
    I am able to get the X-axis drag amount sent via Axis and into the PhaseListener, but at this point I am stuck. I now need to get hold of my component, and tell it how much to move the X-axis.
    Any help is very much appreciated!

    ok! i know for  initial requests  (when a user requesting the page for the first time ) the "JavaServer Faces implementation creates an empty view during restore View phase and the life cycle advances to the render response phase".
    so i think it is impossible to change Uicomponent state in phase listener !!!!   but how can i change Uicomponent attribute before page send to user's browser ?!!

  • Use of JSF Phase Listener?

    There are many many examples of how to 'access' the six phases of the JSF Life Cycle.
    I have a simple page that has two input text fields and one command button.
    I would like to be able to access the contents of the text fields on the page in Phase 2 (APPLY REQUEST VALUES), or other phases. After quite a bit of time I am posting this in the hopes that someone could point me in the correct direction to do this or perhaps someone has a simple example.
    Thanks - Casey

    Code for phase listener, backing bean and output are at the bottom of this note.
    The text field has a Id property of lname. I assume you are referring about using findComponent() against the backing bean that has a corresponding property (RichInputText) for the text field?
    When I run the app I am getting a null for the objReference for the backing bean (line 16 in the output) - see output which then causes a NullPointerException.
    Suggestions on how to get the reference to the backing bean, or the component that will contain the data for the input text field?
    Thanks again - Casey
    The code I am using in the Phase Listener class is:*
    +public class MyPhaseListener implements PhaseListener {+
    +public MyPhaseListener() {+
    +}+
    +public void beforePhase(PhaseEvent pe) {+
    if (pe.getPhaseId() == PhaseId.RESTORE_VIEW)
    System.out.println("Processing new  Request!");
    System.out.println("before - " pe.getPhaseId().toString());+
    +if (pe.getPhaseId().toString().equals("APPLY_REQUEST_VALUES 2")) {+
    System.out.println("lkjhlkjhlkjhlkjh");
    +}+
    +if (pe.getPhaseId().toString().equals("APPLY_REQUEST_VALUES 2")) {+
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ELContext elContext = facesContext.getELContext();
    ExpressionFactory expressionFactory =
    facesContext.getApplication().getExpressionFactory();
    ValueExpression exp =
    expressionFactory.createValueExpression(elContext,
    +"#{BackingBean}",+
    BackingBean.class);
    BackingBean nameData = (BackingBean)exp.getValue(elContext);
    System.out.println(nameData);
    System.out.println(nameData.getLname().findComponent("lname"));
    +}+
    +}+
    +public void afterPhase(PhaseEvent pe) {+
    System.out.println("after - " pe.getPhaseId().toString());+
    if (pe.getPhaseId() == PhaseId.RENDER_RESPONSE)
    System.out.println("Done with Request!\n");
    +}+
    +public PhaseId getPhaseId() {+
    return PhaseId.ANY_PHASE;
    +}+
    +}+
    The code for the backing bean is:*
    package view;
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    +public class BackingBean {+
    private RichInputText lname;
    +public BackingBean() {+
    +}+
    +public void setLname(RichInputText lname) {+
    System.out.println("In setLName");
    this.lname = lname;
    +}+
    +public RichInputText getLname() {+
    System.out.println("In getLName");
    return lname;
    +}+
    +}+
    Output from System.out.println statements:*
    Processing new  Request!
    before - RESTORE_VIEW 1
    after - RESTORE_VIEW 1
    before - RENDER_RESPONSE 6
    In getLName
    In setLName
    after - RENDER_RESPONSE 6
    Done with Request!
    Processing new  Request!
    before - RESTORE_VIEW 1
    In setLName
    after - RESTORE_VIEW 1
    before - APPLY_REQUEST_VALUES 2
    lkjhlkjhlkjhlkjh
    null
    after - APPLY_REQUEST_VALUES 2
    +<Jul 13, 2009 8:27:14 AM CDT> <Error> <HTTP> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@857c75 - appName: 'Application8', name: 'Application8-ViewController-context-root', context-path: '/Application8-ViewController-context-root', spec-version: '2.5', request: weblogic.servlet.internal.ServletRequestImpl@1c70722[+
    +POST /Application8-ViewController-context-root/faces/untitled1.jspx?_adf.ctrl-state=793257214_3 HTTP/1.1+
    +Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-shockwave-flash, */*+
    +Referer: http://127.0.0.1:7101/Application8-ViewController-context-root/faces/untitled1.jspx?_adf.ctrl-state=793257214_3+
    +Accept-Language: en-us,de;q=0.5+
    +Content-Type: application/x-www-form-urlencoded+
    +UA-CPU: x86+
    +Accept-Encoding: gzip, deflate+
    +User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)+
    +Content-Length: 269+
    +Connection: Keep-Alive+
    +Cache-Control: no-cache+
    +Cookie: JSESSIONID=wBr1Kb2GrCDpnhkNNgQyTvJvSjlnWHyvnq9gNWT92kvsFYlGC1Jl!1059440035+
    +]] Root cause of ServletException.+
    java.lang.NullPointerException
    +     at view.MyPhaseListener.beforePhase(MyPhaseListener.java:42)+
    +     at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:228)+
    +     at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)+
    +     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)+
    +     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)+
    +     Truncated. see log file for complete stacktrace+

  • Which component fired phase listener ?

    Hi,
    - I have a custome PagePhaseListener and I would like to know which component of a page fired the listener. Something like:
    public void beforePhase(PagePhaseEvent event) {
    // log the event.getSource().toString()
    - However the code event.getSource().toString() returns the controller object itself and not the object which fired the lifecycle.
    Thank you in advance.

    I could get which component fired an adf page lifecycle inspection the resquest. Here is the code:
    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    Map requestMap = externalContext.getRequestMap();
    Set set = requestMap.entrySet();
    Iterator i = set.iterator();
    while(i.hasNext()) {
    Map.Entry me = (Map.Entry)i.next();
    ILogger.log(this.getClass(), ILogger.TRACE, "request map entry: " + "key: " + me.getKey() + " value: " + me.getValue());
    Inserting this code on my custom phase listener I could verify that my master detail implementation was fireing two many requests and what component was responsible of that. Look for keys oracle.adfinternal.view.faces.event.rich.ClientEvents key and oracle.adfinternal.view.faces.renderkit.newStreamingRecords

  • Phase Listener

    Hi everyone,
    I need to set up some value bindings and actions listener by code, but i cant find the right phase to do it. I need to setup this bindings before the page is actually in use since the first request. the thing is that putting them after the 1st phase when looking the object by its id, is not found; it is found at the end of the render response, but then is too late.
    any ideas?

    I have a fragment which contains a subview. this jsp has its own bacinkg bean, but contains two buttons that the action and action listeners should be setted by another backing bean, and the same for an inputText and its value binding.
    the main jsp makes an include of the fragment at the end of it, so the main's backing bean constructor is over before the fragment's one has began, so i can`t put there the necesary bindings and behavior i need this 3 elements to have. i can't put this in a method afetr everything has loaded because i need this functionality from the begining since they validation buttons.

Maybe you are looking for

  • InDesign CS6 will not open anymore.

    Patch to 8.0.2.413 failed. Reset Preferences failed. Complete reinstall didn't work. HELP!!! I have a Feb. 11th dealine to meet.

  • Can I use a power cord from a Macbook air with a Macbook?

    Can I use a power cord from a Macbook air with a Macbook?

  • Changing DB name

    Hello, I'm learning about changing the database name. I've read the thread change of DB_NAME using DBNEWID utility did not work Following these posts I changed dbname, but not instance name. I want to ask, what is the sense of changing dbname, not ch

  • Exception when opening tools - prefereces

    Hi- I just downloaded JDeveloper 9.0.3.1035 for Win 2000. Pointed it at a JDK 1.3.1, and ran the ojvm installer. When I try to open tools -> preferences, I get an error dialog with the following exception (below). Tried other JVMs without success. Ha

  • How to set column size in sqlplus.exe ?

    SQL> select * from dba_cons_columns where user='USER1' and table_name='PARENT1'; OWNER                          CONSTRAINT_NAME TABLE_NAME COLUMN_NAME   POSITION USER1                          PARENT1_PK PARENT1 COL2          2 OWNER