Managed Bean method called several times in AF:ITERATOR

Dear all,
I can do not to understand this concept in the ADF. Being a beginner, I would like to know
the reasoning behind this.

I use af:foreach components and then I link it to my below managed bean.
<af:panelTabbed id="pt1">
     <af:forEach var="item" items="#{testBean.departmentsData}">
       <af:showDetailItem text="#{item}" id="sdi1"/>
     </af:forEach>
</af:panelTabbed>
public class TestBean {
    public List getDepartmentsData() {
        System.out.println("I was clicked!!!!");
        List lstData = new ArrayList();
        lstData.add("IT");
        lstData.add("Finance");
        lstData.add("Accounting");
        return lstData;
    }
}
On the first charge, it prints 7 times "I clicked".

When I clicked on one of the tab, I get 7 again which means my method was called 7 times.
Any reason behind this. ? Thank you.

I have used JDEV PS3 is told by the way.

Rather than build the list in your getter, build a list somewhere (in the constructor, perhaps). Your getter can then return just this list.

John

Tags: Java

Similar Questions

  • method of before the Phase of initMethod() in view calling several times:

    Hello world

    I dragged a table as read-only table with simple rank of verified selection.
    A button to go there in the page.
    The code in the go button takes the curretn by selecting the current row and the values of print.
    The initMethod() code is execution of the VO.

    The problem is when the page load the initMethod() (before the phase in view) calls several times even after loading the page.
    Continuously its call to this method.

    How to call only once when the page is loaded?

    All suggestions will be really useful.

    Thank you.

    Hello Kumar,
    There are many topics on the web to achieve this.
    This is one of them
    https://blogs.Oracle.com/ADF/entry/an_epic_question_how_to

  • The purpose of programmatic view called several times ExecuteQueryForCollection

    [JDev/ADF v11.1.1.5.0]

    I am trying to create a VO that is not supported by DB, but instead takes its data from an external source (subsequently, a web service, but that's irrelevant to this question). I followed on each sample, I found and have created the VO and all overridden methods. I use this VO to create a LOV list for a VO another attribute, and the values in the LOV will vary based on a value in another attribute in the main volume (this is called LOVs cascading in various places).

    Here's an example, using the HR schema (a little artificial, I admit it):

    -Two your - DepartmentVO and ManagerVO - are defined

    -The DepartmentVO is supported by the DB and a normal EO and VO.

    -L' Manager in the DepartmentVO attribute is set to a supported by the ManagerVO LOV

    -The ManagerVO is programmatic and returns a list of employees who are in the same Department as the DepartmentID in the line of master DepartmentVO. To do this, use a Bind Variable (DeptId) that is set up to take the value of the DepartmentID attribute in the current line of DepartmentVO. This value of binding is used to filter the list of employees referred to only in the same Department.

    -J' replaced the executeQueryForCollection method in ManagerVOImpl. Here, I retrieve the value of the variable DeptId bind parameters passed in object/object2 to the method, and then use to retrieve employees in this Department of my main source.

    So far so good. Presents all works. (He lifts the employees in the same Department and displays them in the popup LOV.) If you change the Department then click to display the attribute Manager LOV, it shows you the list of employees in the new Department.)

    The problem I see is that the executeQueryForCollection method is called several times (2 or 3), causing the recovery of employees in the Department occur several times. For example, the test by running the AM executeQueryForCollection is called when I click the button to display the popup LOV (which makes sense). However, it is said AGAIN when I click the OK button in the popup LOV after selecting one of the values. (This should NOT!) And, if I create a JSF page and drop the data control to create a form and test it in this way, the executeQueryForCollection is called THREE times!

    I have the logic in the class ManagerVOImpl, which checks whether the list of employees has been recovered already, and if so, it's just returns the existing list. However, multiple calls are actually coming from different instances of the VO class, so that they only "see" the list has already been retrieved (because she was retrieved from another instance of the class, not this one).

    So my question is: How can I ADF do not call the executeQueryForCollection several times during the use of the VO as a LOV so that my (very expensive) call in the master repository to retrieve the list of employees is not executed more than necessary?  Is my only option to implement share caching mechanism myself that stores the list of employees of a Department somewhere in memory? I thought that ADF BC will make caching for me at the level VO?

    Thanks for any help that anyone can provide. I have literally been taken with that for two weeks, when I thought it would be a 'fast' to implement! :-)

    I'd be happy to upload/attach the source of my 'ManagerVOImpl' class, if that would be helpful.

    Have you tried to put a conditional statement in your back-end call happens only on your principal of the VO and not on the other 2 forums and see if that affects your functionality?

    that is, if (myIdName == "myVOInstance") {}

    do things;

    }

    I did it with VO this call that some heavy DB stored procedures in the executeQueryForCollection.

  • FieldChangeListener fieldChanged called several times to EditField?

    Why fieldChanged is called several times in an EditField and how to avoid what is happening or maybe even control how many times the method, I want to be called, is called.

    The debugger that I noticed that my method is running serval times, most of the time + 20 times, and it's ruining the flow of just this is an edit field, is far from avoid this? I'm doing something wrong? or is this a normal behavior?

    I'm past the code if it helps, but if I can get the answers to these questions, am sure I can fix the code myself.

    Thank you

    Nevermind, figured it out, sorry for losing space, bandwidth, etc etc.

  • Type of the object called several times Oracle constructor

    I have an object of type with a custom constructor. In SQL, when I reference attributes the constructor is called several times in Oracle 11.2.0.4.

    1. Why the constructor is called more than once?
    2. How can I stop it?

    My current job is about to reference attributes and use the / * + materialize * / tip.


    Problem installation

        create or replace type Foo as object
        (
          Bar1 NUMBER,
          Bar2 NUMBER,
          Bar3 NUMBER,
    
          CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
            RETURN SELF AS RESULT
            DETERMINISTIC
        )
    /
        create or replace type body Foo is
    
          -- Member procedures and functions
          CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
            RETURN SELF AS RESULT
            DETERMINISTIC
          AS
          BEGIN
            SELF.Bar1 := p_Bar1;
            SELF.Bar2 := p_Bar2;
            SELF.Bar3 := p_Bar3;
            dbms_output.put_line('Foo Constructor Called');
            RETURN;
          END;
    
        end;
    

    Problem

        -- Constructor is called 6 times! 
        -- Once for each column and once for each predicate in the where clause.
        SELECT x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3, f
        FROM (
          SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
          FROM dual d
        ) x
        WHERE x.f.bar1 = x.f.bar1 AND x.f.bar2 = x.f.bar2
    

    Output

    Foo constructor called

    Foo constructor called

    Foo constructor called

    Foo constructor called

    Foo constructor called

    Foo constructor called

    Workaround

        -- Work Around
        -- Constructor is called 3 times
        -- Once for each column in the inline view. 
        -- Note, I removed column f (the object type) because it's not compatible with the materialize hint.
        WITH y AS (
          SELECT /*+ materialize */ x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3
          FROM (
            SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
            FROM dual d
          ) x
        )
        SELECT y.bar1, y.bar2, y.bar3
        FROM y
        WHERE y.bar1 = y.bar1 AND y.bar2 = y.bar2
    

    Another solution is described in this thread... Access to the fields of an object custom type... which makes use of a type of collection combined with SCOREBOARD operator, like this...

    create or replace type FooTable as table of Foo;
    
    SELECT x.bar1 AS bar1, x.bar2 AS bar2, x.bar3 AS bar3, value(x) f
        FROM table(FooTable(
          foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3)
        )) x
        WHERE x.bar1 = x.bar1 AND x.bar2 = x.bar2
    ;
    
    BAR1 BAR2 BAR2 F
    1    2    3    (1, 2, 3)
    
    Foo Constructor Called
    

    Hope that helps...

    Gerard

  • Access to the data after the managed service VOImpl in bean method call

    I use JDeveloper 11.1.2.4.

    I created a method to Interface customer and he calls you a managed bean.

    The method is exposed in the control of data and I have a links to it through links on the page.

    The method runs just a view of criteria for a row of data in the database.

    But, because the method does not have a return value, how could access the View object data.

    Here's the Service method and the method of the bean management;

    The service method: in PersonVOImpl.java - should result in 1 row:

    public void getPersonByCnViewCriteria (String cn)

    {

    ViewCriteria viewCriteria = this.getViewCriteria ("PersonVOCriteriaByCn");

    Reset a display criteria of values that may was resolved at design time

    viewCriteria.resetCriteria ();

    this.setCnBind (cn);

    this.applyViewCriteria (viewCriteria);

    this.executeQuery ();

    }

    Method in managed Bean: I have a linking operation method to access the Service method.


    It seems that the Service method is executed successfully.  But, how to access the data after the call?


    protected void getPersonByCn (String cn)

    {

    BindingContainer bindingContainer = this.getBindings ();

    OperationBinding operationBinding = bindingContainer.getOperationBinding("getPersonByCn");

    Map operationsParamsMap = operationBinding.getParamsMap ();

    operationsParamsMap.put (WorkFlowBean.PROPERTY_CN, NC);

    Object result = operationBinding.execute ();

    If (! operationBinding.getErrors () .isEmpty ())

    {

    }


        // How to access data after the call?

    }

    You should never use a class VOImpl or VORowImpl in a managed bean. If you have to use them, create Interfaces and use.

    I'm not too sure if it's good to return a view in a method object.

  • Its value cannot be changed when AF:inpuDate is set to a managed bean method

    Dear gurus,

    I have a date field. MinValue I want to set the default value of the value at the date of the day but also be editable by the user.
    I put its value to a managed bean, odes, which returns the current date in java.util.Date type.
    The value is displayed correctly, but the field is not editable.

    The field that IS NOT bound to any attribute of the entity.

    I searched the internet and this forum, but I have found no solution to this simple question.

    Any help appreciated

    Dimitris,

    You have the value of the element associated with a bean called 'currentDate' attribute, but there is no Set accessor for the property. Where you expect the value to check if the user has changed the value? You would need a method "setCurrentDate()" in your bean for the editable field.

    The get/set accessor you showed us (get/setStartDate) are for the instance of the component, not its value

    John

  • Function used in the view definition is called several times

    I'm writing a view that boils down to the following statement:

    SELECT val, val)
    SELECT SYS_GUID() val
    OF the double
    )

    Against my expectation, which calls SYS_GUID() twice, resulting in two different values for val.

    I have written here as view inline, but it must be a regular view in reality. Is it possible to build this view while SYS_GUID is called only once, even if the resulting value is then selected several times? Naively, I want to affect the outcome of SYS_GUID to a variable, and then select the value of this variable. However, this seems not possible in a view.

    New to Oracle PL/SQL. This works as expected in T - SQL SQL Server.

    Thanks for any help or insight you can provide.

    -Brian

    Hmmm, I have no 11 + available so I can't check a solution, but I would like to test:

    SELECT val, val FROM (
    SELECT SYS_GUID() val
    FROM dual
    WHERE ROWNUM = 1
    )
    

    or

    SELECT val, val FROM (
    SELECT /*+ NO_MERGE */ SYS_GUID() val
    FROM dual
    )
    

    Edit: the no_merge indicator seems to work in 10.2.0.4

    Published by: David_Aldridge on December 14, 2010 23:21

  • Frame 1 called several times

    Hey all,.

    Have a problem with flash. I have the code that I placed in frame 1 that seems to be called many times. I thought that image1 could get called once during initialization when the page first loaded the object but which does not occur.

    Is this normal then? I put my code in a different location?

    Or simply put a stop() action somewhere after frame 1.

    --
    Dave-
    Developer leader
    www.blurredistinction.com
    Adobe Community Expert
    http://www.Adobe.com/communities/experts/

  • Function called several times

    Hello

    In my custom workflow, when the user approves a notification, it goes to the next function in the workflow. I used the command insert in this function to insert data into a custom table. I see that the data is inserted 2 times with different values.
    I was wondering how the insert statement is called 2 times when he was supposed to do only once?

    Any suggestions?

    Thanks in advance.

    2 scenarios that can occur:

    (1) check whether you have a message notification function that is also an insert in the custom table.
    (2) to ensure that the procedure called by your function activity have good if funcmode conditions. Paste the snippet of the Workflow Developer's Guide:

    API standard for procedures called by function activities PL/SQL

    PL/SQL all the stored procedures that are called by the function or the notification of activities in a Workflow Oracle process should follow this standard API format so that the workflow engine can correctly run the activity.

    Important: The Workflow Engine traps errors generated by the function activities by defining a backup point before each function activity. If an activity generates an unhandled exception, the engine performs a restore to the backup point and sets the activity of the error state. For this reason, you should never engage in the PL/SQL to an activity of the function procedure. The questions never one workflow engine commit it is the responsibility of the calling application to commit.

    For environments such as database triggers or distributed transactions that do not allow for recording points, the workflow engine automatically intercepts the errors 'Point unauthorized registration' and differs from the execution of the activity of the base engine.

    Components of Oracle workflow that continue the asynchronous processing, such engines at bottom and the system of Notification, workflow are issued is committed, where appropriate on behalf of the calling application.

    The example in this section is numbered using the notation (1) for ease of use. The numbers themselves are not part of the process.

    (1) procedure
    (itemtype in varchar2,
    ItemKey in varchar2,
    actid number,
    funcmode in varchar2,
    Result out out varchar2) is

    (2)

    (3) start

    If (funcmode = 'RUN') then

    Out result: = ' COMPLETE:';
    return;
    end if;

    (4) if (funcmode = ' CANCEL') then

    Out result: = "FULL";
    return;
    end if;

    (5) if (funcmode = 'SKIP') then

    Out result: = ' COMPLETE:';
    return;
    end if;

    (6) if (funcmode = ' RETRY') then

    Out result: = ' COMPLETE:';
    return;
    end if;

    (7) if (funcmode = ' VALIDATE') then

    Out result: = "FULL";
    return;
    end if;

    (8) if (funcmode = 'RESPONSE') then

    Out result: = "FULL";
    return;
    end if;

    (9) if (funcmode = "forward") then

    Out result: = "FULL";
    return;
    end if;

    (10) if (funcmode = 'TRANSFER') then

    Out result: = "FULL";
    return;
    end if;

    (11) if (funcmode = 'QUESTION') then

    Out result: = "FULL";
    return;
    end if;

    (12) if (funcmode = ' REPLY') then

    Out result: = "FULL";
    return;
    end if;

    (13) if (funcmode = "TIMEOUT") then

    If () then
    Out result: = "FULL";
    on the other
    Out result: = wf_engine.eng_timedout;
    end if;
    return;
    end if;

    (14) if (funcmode = "") then
    Out result: = ' ';
    return;
    end if;

    (15) exception
    while others then
    WF_CORE. CONTEXT ("", "",
    , ,
    TO_CHAR (), );
    lift;

    (16) end ;

  • Paint is called several times...

    Hello

    My code has a check box form field, on which I paint custom color development on its width and its height. The user interface works fine, but her object is called repeatedly even though no cases of the user (such as scrolling or selection) occurs on the ground.

    Here is my code block:

    CheckboxField checkBoxField = new CheckboxField(checkBox
                            .toString()) {
    
    protected void paint(Graphics graphics) {
       System.out.println("in paint() of cb");
       if (this.isFocus()) {
        System.out.println("is focused");
        graphics.setColor(getHighlightColor());
        graphics.fillRect(0, 0,    this.getExtent().width,this.getExtent().height);
       }
    
    graphics.setColor(getFontColor());
    super.paint(graphics);
    }
    };
    

    Also, I found another similar post but it dint work for me: http://supportforums.blackberry.com/t5/Java-Development/paint-method-gets-called-repeatedly/m-p/5829...

    Any help would be much appreciated...

    P.S. This checkbox field is held in a verticalFieldManager.

    Thank you...

    Hey...

    Thanks for the reply Peter...

    finally understood it...

    My screen had an image bitmap field, in which object, I used the setSpace(). The setSpace() seems to invalidate the field and thus invoke its object in a nested way.

    However, what surprised me are the fact that such behavior was only on the screen with the check box and the date fields.

    Anyway, moral of the story: be careful of API do you use in object, do NOT invalidate the field.

    Thank you...

  • (Bug)  Function that is called on the authenticationSuccess parameter is called several times

    < rtc:AdobeHSAuthenticator id = "auth" authenticationKey = '{authToken}' protocol = "rtmfp" authenticationSuccess = "onAuthSuccess (); "authenticationFailure ="onAuthFailure (event); "/ >

    The onAuthSuccess() function that is called at all times

    Hi Ashish,

    Can you give us the smallest possible complete app that reproduces it

    question? I just built a simple and it worked.

    Thank you

    Nigel

  • Oracle ADF 11 g: invoke managed bean method when the page resizing.

    Given the following code:
     <af:clientListener method="getElementWidth"
                                       type="propertyChange"/> 
                    <af:serverListener type="customEvent"
                                       method="#{columnSizeBean.handleRequest}"/>
    Is there a client listener that can be triggered when resizing browser window?
    Something like:
     <af:clientListener method="getElementWidth"
                                       type="[[[[something like a window resize]]]]]]"/> 
                    <af:serverListener type="customEvent"
                                       method="#{columnSizeBean.handleRequest}"/>
    NOTE:
    getElementWidth is a javascript method in my current code, while columnSizeBean is a sessionScope bean who did some calculations on the width of a table column.

    Published by: Andrei C. on May 18, 2010 05:49

    Hello

    No, it isn't. However, in this case you can use vanilla JavaScript and register to the browser DOM to receive the event notification. If you notice rceive you access the server listener you put on the af:document component. It should work

    Frank

  • PushApplication onMessage is called several times

    Hi guys,.

    I contacted my team BE but I'm waiting for answer, I want to ask the community:

    Your onMessage is called repeatedly with the same message?

    I see in the code for the examples of the RIM, they check that this message is new (not melted yet):

        public static void process( PushInputStream pis, Connection conn ) {
            Logger.log( "Reading incoming push message ..." );
    
            try {
    
                HttpServerConnection httpConn;
                if( conn instanceof HttpServerConnection ) {
                    httpConn = (HttpServerConnection) conn;
                } else {
                    throw new IllegalArgumentException( "Can not process non-http pushes, expected HttpServerConnection but have "
                            + conn.getClass().getName() );
                }
    
                String msgId = httpConn.getHeaderField( MESSAGE_ID_HEADER );
                String msgType = httpConn.getType();
                String encoding = httpConn.getEncoding();
    
                Logger.log( "Message props: ID=" + msgId + ", Type=" + msgType + ", Encoding=" + encoding );
    
                if( !alreadyReceived( msgId ) ) {
    }
    }
    

    You have the same control in your application?

    Thank you

    Eugen

    There is no guarantee that dups can be sent to the device, but in my experience its pretty rare. You will need to add a message id to the http header when you tap the message to make it work.

  • Why the method in the several times called session bean

    Hello
    I work with Jdev 11 g.
    I created an example Web J2ee Application.
    In the model project, I created:
    1 - entity Bean
    2 - stateless session bean (which contains a method that get the list of username == > em.createNamedQuery("OsaUser.findAll").getResultList ();)

    In the view controller project I created:
    1 - managed bean, session scope, a getter that calls the session bean and retrieve the result of the query.
    2 - a JSF page with af:table element with the value bound to the list in the managed bean.

    When I run the application, the data is displayed, but since I put system.out message I get this message several times.
    When I try to debug the application the breakpoints on the managed bean and session bean are available several times.

    Can you please advice why this happens.
    Concerning
    Emile BITAR

    Hello

    partially, it's the cycle of life and partially a known bug. The method is called during ApplyRequest and RenderResponse. If you check this in your output, so you see that make answer calls at least three times, which is the bug that we set. As a temporary work around, set a flag within the scope of the request (since your bean's scope of session that you use a requestScope attribute). The first time you run, you set the attribute flag. So every time its called again, you check to see if the indicator exists and if ignore the request. Because the flag is set to request scope, you needn't clean it explicitly

    Frank

Maybe you are looking for