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

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

  • 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 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 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

  • 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

  • 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

  • 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.

  • [ADF, JDev12.1.3] Opening SESSION: a session ID, HTTPSession, brought bean, UserData... where to store the information? (And other doubts...)

    Hallo,

    my simple application has this main stream job boundless...

    1)

    I see that when I call the login page of this URL http://127.0.0.1:7101 / MyApplication/faces/login, to which - in the address bar - it is auto-ajouté for example ' jsessionid = Wn2ymE_3cC2JXHYtG7_ocZDgMgonLyr376zejB-ui28UPlm5tiuB! 1535501325 ".

    So I guess that the session exists as soon as the user access the login page.

    • I would like to know if I have to worry about a possible previous session (especially another user session).
    • If the user on the home page click the back button in the browser the application creates a new session to destroy the possible previous session?
    • BdW, if my request to place the values in the HTTP session would be a good practice as part of the bean connection null all the attributes of the session?
    • And if my request to place the values in UserData would be a good practice as part of the bean connection null all the attributes of the container UserData?

    2)

    • Is it better to store the information in the HTTP session or UserData?
    • It is less safe than the other? Otherwise why is there the need to have 2 types of sessions?
    • Could he have no sense in storing an individual data in the HTTP session and UserData at the same time?
    • I have seen that the HTTP session is very easy to access, view and (if necessary) and the layers of the model. Is the same as for UserData, or it can be accessed only by the model layer?

    3)

    • In my case, I want to share my application the user in user data:
      • First and last name (only at the end of the display)
      • Name of the service (only at the end of the display)
      • Username and DepartmentId (these hairy should be passed to the query and the view of your criteria)
    • Where I put those values? Who, in the HTTP session? Who in UserData?

    4)

    • I'm in doubt if using a scope session bean or - since the data that I have to share is really little - use the 'basic' (e.g. ectx.getSessionMap () .put ("key", "ValueToStore")).
    • If I use an extended session bean and I store of simple values (integer, String,...) I don't have to worry about serialization (de)?
    • A scope session bean is accessible from the model layer as the HTTP session basis (what I can put by ectx.getSessionMap () .put ("Key", "ValueToStore"))?
    • And in my situation I could handle everything with a single between UserData anda HTTP session?

    These questions are intended to create a simple login system that stores data needed somewhere in the different parts of my application.

    So any advice is welcome!

    Thank you

    Federico

    1)

    I see that when I call the login page of this URL http://127.0.0.1:7101 / MyApplication/faces/login, to which - in the address bar - it is auto-ajouté for example ' jsessionid = Wn2ymE_3cC2JXHYtG7_ocZDgMgonLyr376zejB-ui28UPlm5tiuB! 1535501325 ".

    So I guess that the session exists as soon as the user access the login page.

    • I would like to know if I have to worry about a possible previous session (especially another user session).
    • If the user on the home page click the back button in the browser the application creates a new session to destroy the possible previous session?
    • BdW, if my request to place the values in the HTTP session would be a good practice as part of bean connection null all the attributes of the session?
    • And if my request to place the values in UserData would be a good practice as part of bean connection null all the attributes of the container UserData?

    -When you close your browser, this will destroy the session

    -None

    -It will be much easier to invalidate the entire session (HttpSession method for this object)

    -When you destroy the http session, it will destroy the Application modules, and it will destroy UserData

    2)

    • Is it better to store the information in the HTTP session or UserData?
    • It is less safe than the other? Otherwise why is there the need to have 2 types of sessions?
    • Could he have no sense in storing an individual data in the HTTP session and UserData at the same time?
    • I have seen that the HTTP session is very easy to access, view and (if necessary) and the layers of the model. Is the same as for UserData, or it can be accessed only by the model layer?

    -We already discussed in a previous thread so I won't comment

    -both are secure. HttpSession exist in java web applications and UserData is specific ADF.

    -Maybe (for example, it is not recommended to access the HttpSession of model project, so you can store some data in the UserData (to be referenced from your, etc.) and managed (so you can bind them directly to UI) Bean)

    -Are accessible only from template (but you can expose a custom to ViewController method that accesses UserData)

    3)

    • In my case, I want to share my application the user in user data:
      • First and last name (only at the end of the display)
      • Name of the service (only at the end of the display)
      • Username and DepartmentId (these hairy should be passed to the query and the view of your criteria)
    • Where I put those values? Who, in the HTTP session? Who in UserData?

    My opinion:

    Name, first name, name of the Department-> session brought average managed (so you can link that directly to the user interface components)

    UserId, DepartmentId-> UserData (or you can store managed bean and pass as parameters to methods of model project)

    4)

    • I'm in doubt if using a scope session bean or - since the data that I have to share is really little - use the 'basic' (e.g. ectx.getSessionMap () .put ("key", "ValueToStore")).
    • If I use an extended session bean and I store of simple values (integer, String,...) I don't have to worry about serialization (de)?
    • A scope session bean is accessible from the model layer as the HTTP session basis (I can put by ectx.getSessionMap () .put ("key", "ValueToStore"))?
    • And in my situation I could handle everything with a single between UserData anda HTTP session?

    -with getSessionMap () .put (), you must pay attention to the data types when you change or retrieve values (for example, do you know if DepartmentId is Integer, BigDecimal, oracle.jbo.domain.Number,..) If this isn't "type-safe". In addition, it is easier to understand what your application keep in session if you managed bean that in order to find all the places you're calling the method getSessionMap () .put ().  And controlled beans are a 'natural' way to keep data in a JSF/ADF application.

    -Not (just brand bean session with the Serializable attribute)

    -You can do something similar to this, but this is not a recommended practice because it would break the MVC pattern

    -If you do not have too much, you can keep everything in HttpSession and expose methods to set the binding vars.

    Dario

  • Can not copy the content of my Cybershot C901 of SE to my new Elm SE

    I need help.

    I managed to download Media Go on my PC and did a synchronization of the content (especially for media files) to Media Go environment.

    I then cut. At the time wherever I am, my old phone records WILL disappear. And when I connect the USB to my new Elm, I can not of course copy the 'old' files above.

    Its not obvious (to me) what I'm doing wrong.

    Can someone please help? Its my wife's phone and I'm getting an attitude

    Thank you

    Yes try what I said above.

  • 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);

  • Components of the access to the content on the page loading

    Hello

    I use ADF Faces 11g.

    I have a chart element in a page. The page has a support bean and the graphic component is bound to a variable in backing bean.
    What I want to do is to manipulate this component before loading the page. I tried to implement beforePhase and afterPhase PagePhaseListener and access to the component of these methods, but these methods are called before that the elements on the page are initialized. So I get a null pointer exception when trying to get the component in beforePhase() or afterPhase.

    What should I do to access a UI component in the page on all access to the page?

    Thank you.

    Hi Deniz,

    Exposing how the page for support of bean and add the component you want to add in the Set accessor of the form method?

    Something like

        public void setF1(RichForm f1) {
          RichCommandButton cb1 = new RichCommandButton() ;
          cb1.setText("Button added from backing bean");
          cb1.setId("cb1");
          cb1.setVisible(true);
          f1.getChildren().add(cb1);
    
            this.f1 = f1;
    
        }
    

    Arun-

  • Add dynamic html - InnerHTML as implementation of the components of the Adf.

    Hello

    I need to view the html code on the jsff page which is backing bean.

    I need to display html code on page jsff dynamics. I'll put the html code in a requestMap attribute that must be added and displayed on the jsff page.

    For example,.
    BackingBean
    requestMap.put ('DetailText', ' < p > This is sample text for description < /p > < img src=\"test.png\" > "");

    JSFF Page
    < af:panelGroupLayout layout = "vertical" >
    < af:outputText value = "#{requestScope.DetailText}" / >
    < / af:panelGroupLayout >


    Above code is the hardcoded value display / plain html code.

    I need to do something like innerHTML style in the components of the adf.

    Is it possible to apply this? help you enjoy!

    Hello

    This would require JavaScript and the access to the HTML code that is generated in the user interface. For example usually the content of a component is represented by an element with the ID of the componentId::content HTML. In this way it can be found on the DOM using findElementById. However, this isn't really a future prove way and fights the idea of development based on the JSF components when you make a hypothesis on the output stream. So was wondering if using f: verbatim for the included HTML help

    Frank

  • How to access all the lines one by one, a table ADF via managed bean

    Hi Experts,

    Hi I'm new in the ADF.

    Could someone help me to fix the case below?

    Scenario - I have a table called Test_T1 that have 4 columns C1, C2, C3, C4. Creation of EO, VO and AM for test_t1.
    When created in pages ADF, I selected the option "automatically exposed components UI in new managed bean" (mynewmanagedbean.java).
    Control data drag and drop Test_T1 table in the page as a table of the ADF.
    Set the properties is read-only C1, C2, C3 and C4 is an input text.
    Add after the table and attathed button action on the mynewmanagedbean.java bean managed.
    At the time of the Test_T1 page filled with a few No.. lines (such as 9).
    How can I access all the lines above through the key without selection of these.
    In fact, I want to print all the rows of the table in the log at the time to press the button.

    Thanks in advance.

    Sorry for the delay, the code was copied from another test case. You can work directly with the line...
    I created a new test case based on the departments of the HR schema table:

    import oracle.adf.model.BindingContext;
    import oracle.adf.model.bean.DCDataRow;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.adf.share.logging.ADFLogger;
    
    import oracle.jbo.Row;
    
    public class DumpRows
    {
        private static ADFLogger _logger = ADFLogger.createADFLogger(DumpRows.class);
        public DumpRows()
        {
        }
    
        public String cb3_action()
        {
            DCBindingContainer bindings =
            (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            DCIteratorBinding dcIteratorBindings =
            bindings.findIteratorBinding("DepartmentsView1Iterator");
    
            // Get all the rows of a iterator
            Row[] rows = dcIteratorBindings.getAllRowsInRange();
            for (Row row : rows) {
                String depname = (String)row.getAttribute("DepartmentName");
                _logger.info(depname);
            }
            return null;
        }
    }
    

    As you do not have the class of line interface build you must get the attributes in their names. Be careful here, because any misspelling is cought only when you run the application.

    Timo

Maybe you are looking for