A loop in the t receives all the lines in a managed Bean

Hello

Something strange happens to me. I use this code to iterate hollow VO to export data to an excel file:

BindingContainer links is BindingContext.getCurrent () .getCurrentBindingsEntry ();.

DCIteratorBinding dciter = (DCIteratorBinding) bindings.get ("< MyIterator >");

RowSetIterator rsi = dciter.getRowSetIterator ();

RSI. Reset();

While (rsi.hasNext ()) {}

MyVORowImpl line = rsi.next ((MyVORowImpl));

Logger.Warning ("Row" + row.getAttribute1 ());

}

rsi.closeRowSetIterator ();

If use this code in the AM, it works well and it loop through all the records, but if use it a backing bean it is the turn of all the archives less 1!

Any suggestion? I use Jdev 12.1.2


Best regards

Jose.

Hello

You can try something like below

RSI. Reset();

If (RSI. First()! = null) {}

MyVORowImpl line = rsi.first ((MyVORowImpl));

Logger.Warning ("Row" + row.getAttribute1 ());

}

While (rsi.hasNext ()) {}

MyVORowImpl line = rsi.next ((MyVORowImpl));

Logger.Warning ("Row" + row.getAttribute1 ());

}

Thank you

Alisson.

Tags: Java

Similar Questions

  • Set the value of selectOneChoice managed Bean

    Hello Experts,

    My script is as follows: -.

    I have a selectOneChoice in my page and I fill it with values in the loading of the page (in the constructor of my managed bean) and he filled in correctly

    < af:selectOneChoice binding = "#{viewScope.MyBean.select}" >

    < f: selectItems value = "#{viewScope.MyBean.arr}" >

    < / af:selectOneChoice >

    ARR = new ArrayList < selectItem > ();

    arr. Add (new selectItem ("1", "Label 1"));
    arr. Add (new selectItem ("2", "Label 2"));
    arr. Add (new selectItem ("3", "Label 3"));
    arr. Add (new selectItem ("4", "Label 4"));


    Now, I need when I click a button on my page, make sure the value selected from the selectOneChoice '1 '.

    I tried the following, but it does not work:

    1 - select.setValue("1");

    2 - SelectItem TR = new SelectItem ("1", "Label 1");
    select.setValue (si);


    So, how can I do in my managed bean?


    I appreciate your help and thanks in advance

    The has a value property that the component stores the selected value. You can either declare a temporary variabel on the page (http://tompeez.wordpress.com/2013/03/25/creating-variables-and-attribute-bindings-to-store-values-temporarily-in-the-pagedef/) and use this variable to store the selected value, or you can use a bean for this property. Once you have set the value property, you can select the entry by setting the value property to the index that you want to select.

    Timo

  • [ADF, JDev12.1.3] master / detail af:tables the link is handled by ExecuteWithParams: how to create a master report / detail in a loop on the lines?

    Hallo,

    I have a page with 2 legs and they both contains an af:table created by dragging an instance of VO in the user interface.

    The 1st tab uses a master VO while the 2nd uses a VO detail.

    Between 2 your, there is not a link of VO master / detail.

    Opening Details tab I update the secondary table by calling the method ExecuteWithParams of the detail VO instance (in a managed bean).

    I would now like to generate a report that loop on the master table and that, for each line of master:

    • He writes in the report;
    • loops of registration of details (which are based on the master record) and also writes the report.


    Could you kindly suggest me which is the best way to achieve that through a code to write in a managed bean?

    Here I am interested how do to loop through the data, not in how to write the report.

    Thank you

    Federico

    Yes it will affect the selected line. If you want to ignore try using this code

        DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("DepartmentsView1Iterator");
        ViewObject vo = iter.getViewObject();
        for (int i = 0; i < vo.getEstimatedRowCount(); i++)
        {
          Row r = vo.getRowAtRangeIndex(i);
          System.out.println("DeptId= " + r.getAttribute("DepartmentId"));
        }
    
  • ADF - components of the access to the contents of a managed bean in a HA environment ViewScope.

    Hi all

    I have a question, I am a beginner with ADF and learn a lot through these forums and Google

    Using Jdeveloper 11.1.1.7

    is the question I have, I have a cluster/HA environment (2 knots) and move my application to use HA.

    I changed the ADF - config.xml to add the following line:

    " < adf-controller-config xmlns =" http://xmlns.Oracle.com/ADF/controller/config "> "

    < adf-scope-ha-support > true < / adf-scope-ha-support >

    < / adf-controller-config >

    I currently have a managed bean (ViewScope) and it has all my actionListeners/valueChange etc... etc... It also has my UIComponent links and I have also several methods that define specific attributes on these components and then do:

    AdfFacesContext.getCurrentInstance () .addPartialTarget ("ComponentRefHere");

    I am aware that I have to put my beans managed to implement Serializable I also understand that the UI components are not serializable.

    I use the ComponentReference method that is to say:

        private ComponentReference<RichPanelBox> iframePB;
    
        public void setIframePB(RichPanelBox component) {
            iframePB = ComponentReference.newUIComponentReference(component);
        }
      
        public RichPanelBox getIframePB() {
            return uiComponentBean.getIframePB();
        }
    

    is the question I have, I can leave it like that? or will I move them to a different managed bean?

    If so, how should I put the bean, it must also implement serializable, and how do I access them from my managed bean viewScope.


    Thank you

    You don't have to. Https://docs.oracle.com/javaee/6/tutorial/doc/gjbbk.html documentation

    The beans that use the scope of the conversation, application, or session must be serializable, but beans that use the scope of the request need not be serializable.

    I personally always add the serializable interface as the bean has never should be selected for serialization, it should not control. It is easier to tell everyone to add it anyway. In this way, you can use the same class in all scopes.

    Timo

  • Get the component Id in managed bean

    Hi experts,

    I ask a stupid question, but as I'm a newbie, I hope you will forgive me .

    I use JDev version: 11.1.2.3.0 My question is: is it possible to get a component inside a managed bean id? By components, I hear, buttons or menu items. The scenario, I want to create is:

    I use JasperReports to generate required reports. I would like to have something like a Menu with different elements. By clicking on each of them, set a string in the managed bean I use to generate reports (in fact the string would be the name of the jrxml file I'll load). And this string would get its value based on what menu item is selected.

    Is it possible to do such a thing? Or maybe another way would be more appropriate?

    Thank you in advance!

    Hello

    Then, when you press a menu on the page item, have a method called (all menu items call this action method), this method gets the Id (or maybe something else) of the menu item called him.

    Do not use the action property but the ActionProperty listener. Then the ActioneEvent in the managed bean method you navigate to the item getUIComponent() and call getId on it. This should solve the use cases

    Frank

  • Invoking the CreateInsert of a managed bean

    Hi all

    I'm trying to call a CreateInsert operation on a view of a method object in a managed bean. The method is assigned as the actionListener for a toolbar button. For this, I modified the file xxxPageDef.xml with the wizard, who introduced something like this:

    & lt; action = "CommercialReferenceVO1Iterator" id = "CreateInsertPepe" IterBinding
    InstanceName = "DesignRequestAMDataControl.CommercialReferenceVO1"
    DataControl = "DesignRequestAMDataControl" RequiresUpdateModel = "true".
    Action = "createInsertRow" / & gt;
    & lt; / code & gt;

    I invoke the method using the EL from Steve Muench class as follows:

    EL.invokeMethod ("#bindings. CreateInsertPepe.execute', null (class), null);

    I do something appropriate? Because the truth is, it does not work :)

    What I really need, is create and insert a new row into an object of the detail view, and then change the tab currently selected programmatically to display the edit page for the new line.

    I hope that my question is at least some logic...

    Thank you!

    Juan Manuel

    Try this code in your method of action/actionListener managed bean:

    OperationBinding createInsertOp = (OperationBinding)getBindings().get("CreateInsertPepe");
    createInsertOp.execute();
    

    The code only inserts the line. Programatically displaying the edit page for the new line it is something else. If my suggestion is to execute the code inserts really the only line. If its ok, then just add the code that automatiaclly displays the edit page. In this way we can isolate the problem.

    Make sure the CommercialReferenceVO1Iterator is in the iterator header for the CreateInsert to work on a ViewObject detail.

    Another thing is that in your pagedef, I noticed the action links, the 'Action' attribute has the value "createInsertRow". You use charger 11 g? I don't know if its new in 11g but I use ADF 10 g and the attributes of 'Action' have numeric values, where a CreateInsert operation would have an Action = "40".

    Best regards

    Anton

  • How to find the JSFF name in managed bean

    Hi gurus,

    I'm new in the adf and the use of 11.1.2.3. I'm looking for the name of page jsff managed bean.  For example, if I have abc.jsf contains a fragment of xyz.jsff. I want when I click on the button in the jsff page, a pop shows me the name is xyz.jsff.

    Thank you

    Hello

    to get the page name, FacesContext.getCurrentInstance () .getViewRoot () .getViewId () (return abc.jsf). If you expose the page through a region of the ADF fragment, then the call is

    ControllerContext.getInstance () .getCurrentViewPort () .getViewId () (returns xyz if the activity view has the same name as the file xyz.jsff Physics)

    Frank

  • Get some facets of a provision of the limousine Panel in managed bean

    Hi all

    Jdev version: 11.1.1.7.1

    I have a panel with 3 tabbed view detail headers.

    In each details see the headers I have a sign stretching layout and in one of the facets of the expandable Panel layout, I have an af:tree.

    My use case is at the click of a button at the top of the Panel tabs that I need to know which headers detail see Eastern disclosed and get the tree.

    I tried to use the suite of methods:

    for (int i = 0; i < getPanel () .getChildCount (); i ++) {}

    ShowDetail RichShowDetailItem =

    (RichShowDetailItem) getPanel .getChildren () .get (i) ();

    get the open tab

    {If (showdetail {. isDisclosed()})}

    UIComponent component is findComponent (showdetail , RichTree.class);.

    If (components! = null) {}

    return component (RichTree);

    }

    }

    }

    public static UIComponent findComponent (base class UIComponent type) {}

    UIComponent result = null;

    Point UIComponent = null;

    for (int i = 0; i < base.getChildCount (); i ++) {}

    Child UIComponent = base.getChildren () .get (i);

    Item = child;

    If (type.isInstance (child)) {}

    result = child;

    break;

    }

    result = findComponent (element, type);

    }

    return the result;

    }

    Now, I'm able to get the RichPanelStretchLayout, but not able to get the facets of the expandable Panel layout.

    Can someone tell me if there is another way to get the facets?

    Thank you

    Hello

    I could make it work using the code below:

    public static UIComponent findComponent (base class UIComponent type) {}

    UIComponent result = null;

    Point UIComponent = null;

    for (int i = 0; i)< base.getchildcount();="" i++)="">

    Item = base.getChildren () .get (i);

    If (type.isInstance (item)) {}

    result = item;

    return the result;

    }

    result = findComponent (element, type);

    }

    for (int i = 0; i)< base.getfacetcount();="" i++)="">

    Iterator child = base.getFacetsAndChildren ();

    While (child.hasNext ()) {}

    Item = child.next ();

    If (type.isInstance (item)) {}

    result = item;

    return the result;

    }

    result = findComponent (element, type);

    }

    }

    return the result;

    }

    Thank you

  • GET THE NEXT STOP OF THE TRAIN FROM A MANAGED BEAN (JDEVELOPER AND ADF).

    Hello.

    I have a train that works perfectly with the buttom train Assistant; but when I try to create a custom button to the next train stop to skip a prompt to alert of error:

    "java.lang.NullPointerException ".

    "ADF_FACES-60097: SERVER SO THAT PPR, #2 EXCEPTION"


    The managed code of the action of the bean is:


    public String cb1_action() {}

    Add the code in the event here...

                         

    ControllerContext controllerContext = ControllerContext.getInstance ();

    ViewPortContext currentViewPortCtx = controllerContext.getCurrentViewPort ();

    TaskFlowContext taskFlowCtx = currentViewPortCtx.getTaskFlowContext ();

    TaskFlowTrainModel trainModel = taskFlowCtx.getTaskFlowTrainModel ();

    TaskFlowTrainStopModel currentStop = trainModel.getCurrentStop ();

    trainModel.getNextStop (currentStop);

    Returns a null value.

    }

    Best regards.

    Your use case is described in this blog http://www.oracle.com/technetwork/developer-tools/adf/learnmore/82-programmatically-navigate-trains-396873.pdf

    Timo

  • Disable + Darken Background under the Popup to a managed Bean?

    I invoke a popup (Panel window) of a class of support as
    RichPopup.PopupHints hints = new RichPopup.PopupHints();
    callPopup.show(hints);
    But the background is not get clouded and the components of the page are still clickable... Unlike the declarative method where the background to get dark / disabled.

    Thank you
    < police = "courier" > (using Jdev 11 g R2, Fusion Web ADF) < / make >

    Hello
    If you use the dialog box or a window within a popup, you must set its Modal attribute to true.

  • How to loop through the CSV file

    Hello

    I want to loop through each column in a CSV file.
    And while the closure of each column, I want to loop every line starting with line 2 St.

    I wrote the code below, but it's a loop in the lines from rank 1.
    How can I start the loop from the 2nd row in the CSV file?
    (see code below)

    Can someone tell me how to proceed?

    THX




    <!-Download and read the file CSV - TXT->
    < cffile action = "read" variable = "C:\Documents and Settings\user\Desktop\EM-CSV\test.csv" file = "csvfile" >

    <!-browse the CSV - TXT file on line breaks and insert into the database->
    < table border = "1" >


    < cfloop index = list 'index' = "' #csvfile # ' delimiters =" #chr (10) ##chr (13) #">"

    <!-< cfoutput > #listgetAt('#index#',1, ',') # < / cfoutput > < br >->
    < b >
    < td > < cfoutput #index # > < / cfoutput > < table >
    < td > < cfoutput > #listgetAt('#index#',2, ',') # < / cfoutput > < table >
    < td > < cfoutput > #listgetAt('#index#',3, ',') # < / cfoutput > < table >
    < /tr >

    < / cfloop >
    < /table >

    Hi Like2Flex,

    The problem is that coldfusion does not see

    list = "a, b, c, d.

    as a list of 9 things you expect. He just sees 4 elements a, b, c and d because Coldfusion does not include two delimiters next to each other.

    A solution to the problem is to manually insert a space between two delimiters that are side by side. Here is an example of such a solution




    length of the list: #listlen (list) #

  • Dynamically apply the color to the lines of Table

    Hello

    I use JDeveloper - 11.1.1.6.0 version

    I have a requirement to apply the background color for rows in the table dynamically.

    In the table, I have a few lines with a checkbox.

    When I select the checkbox of the line, the line selected as well as lines before and after the selected line should be displayed with a background color.

    Please let me know of inputs for this question.

    Thank you
    Ravi

    Hello

    You can do this by surrounding components of the cell (outputText, inputText, checkBox etc) with for example a panelLabelAndMessage component. Then on this property of component inlineStyle use EL to refer to a property of the managed bean. The managed bean property can now assess the State of checkbox selection. The part of thing in your question is to say during the rendering of the previous and next row that the checkbox in the line between has been selected. You must find a way to say this. An option would be to apply the logic as below

    JUCtrlHierNodeBinding currentRenderedAdfRow = ... use facesContext --> getApplication --> getExpressionFactory --> createValueExpression to create a handle to the #{row} expression
    Row rw = currentRenderedAdfRow.getRow();
    
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingEntries();
    
    DCIteratorBinding dciterator = (DCIteratorBinding ) bindings.get("Name of iterator used by table ");
    RowSetIterator rsIterator = dciterator .getRowSetIterator();
    
    Row prevRow = rsIterator.setCurrentRow(rw);
    int currRowIndex = rsIterator.getCurrentRowIndex();
    
    Row prevRow = getRowAtRangeIndex(currRowIndex-1);
    Row nextRow = getRowAtRangeIndex(currRowIndex-1);  
    
    //return CSS that colors the background if the following conditions are true
    
    if ( ((DataType) rw.getAttribute("checkBoxAttr")) ||  ((DataType) prevRow .getAttribute("checkBoxAttr")) |  ((DataType) nextRow .getAttribute("checkBoxAttr"))){
    
      //color background returning CSS
    
    }
    
    else{
      return empty string
    }
    

    I wrote this code to the top of my head, to ensure you are looking for null pointers (for example if there is no such thing as a prev-line). Also consider caching the calculation so that it doesn't have to be performed for each cell in a row, but only once per line. For example you can save the color and the line key in a bean managed in scope view and then compare the key with this bean managed before performing the calculation

    Frank

  • Calling the method to a different bean

    Inside a workflow, I am running the code inside a managed bean, and I want to call a different managed bean method. How can I do this?

    Hello

    You can do this in two ways:

    Using Dependency Injection:

    In the configuration file of your project faces that defines the management of bean, a bean managed
    property may be declared as initialized with a reference to an another managed bean:


    neededBean
    fqn.to.NeededBean
    session


    usingBean
    fqn.to.UsingBean
    request

    neededBean
    #{neededBean}

    2. with the help of research

    FacesContext facesContext = FacesContext.getCurrentInstance ();
    NeededBean neededBean
    = (NeededBean) facesContext.getApplication)
    .createValueBinding("#{neededBean}").getValue (facesContext);

  • Apple Watch: can I receive all messages from whatsapp on my Apple Watch, but not the Group whatsapp messages, don't know why... Help, please. Besides, my watch is custom in Spanish, but only answer messages Whatsapp understands English... someone kn

    I can receive all messages from whatsapp on my Apple Watch, but not the Group whatsapp messages, don't know why... Help, please.

    Besides, my watch is custom in Spanish, but only answer messages Whatsapp understands English... anyone know why? Thanks to you all!

    Hello

    To change the language for a response on your watch: Press answer > firmly press the screen > press on choose language > select Spanish.

  • My ability to thunderbird to receive the mail suddenly stop and it worked before. What can be the reason? Now, I'm not able to receive all e-mails.

    My ability to thunderbird to receive the mail suddenly stop and it worked before. What can be the reason? Now, I'm not able to receive all e-mails.

    This forum is the official place to support Thunderbird. There is no phone support.
    If you think that this helps to explain the problem, you can add a screenshot to your message.
    You are supposed to follow instructions and suggestions that precede.

Maybe you are looking for