Binding ADF UI components to managed beans instead of using bindings

Hi All,
We are working on a ADF based development project and we have complex data input forms.
We have close to 200 input forms for different products and each form has different details.
Requirement is to store the data captured in the input forms as XML in database instead of storing the information in relational tables to avoid creating tables for each of the 200 products.
We are planning to capture user input in page flow scoped managed beans and when user save the data, generate the XML from managed bean data and store the XML string in DB using ADF BC.
So we would develop the UI more like a normal J2ee application using JSF where managed beans are used to collect data, and then use ADF BC for database persistence.
Is it a good practice to bind the managed beans to UI bypassing the bindings? (We can't use bindings as we store data in XML format).

Hi Alex,
That is not the right way to get the component, #{it1} is not valid.
Here is the sample code to get the component by id, but is not recommended as you should know the parent component ids as well and it would be difficult to maintain in long run:
        FacesContext context = FacesContext.getCurrentInstance();
        context.getViewRoot().findComponent("<id>")What is your exact usecase?
Any specific reason for not using binding property?
Sireesha

Similar Messages

  • ADF Faces: How to get the ADF BindingContainer in a managed bean?

    Hi,
    I not sure how to get the BindingContainer instance from inside of a managed bean method. I have tried the following config, but it does not work in all situations.
      <managed-bean>
        <managed-bean-name>backing_showBooks</managed-bean-name>
        <managed-bean-class>view.backing.ShowBooks</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
          <property-name>bindingContainer</property-name>
          <property-class>oracle.adf.model.binding.DCBindingContainer</property-class>
          <value>#{bindings}</value>
        </managed-property>
        <!--oracle-jdev-comment:managed-bean-jsp-link:1showBooks.jsp-->
      </managed-bean>When an ActionListener- method of my ShowBooks bean is called the property bindingContainer is NULL!!
    Is there a save way to get the BindingContainer in my bean??
    Any hints are welcome.
    Thanks,
    Markus

    Maybe I just need another pair of eyes but when I set this up as explained and watch it in the debugger my method public void setBindingContainer(DCBindingContainer bc) gets called but bc is null. Can anyone help?
    Thanks
    Backing Bean-
    private DCBindingContainer bindingContainer;
    public void setBindingContainer(DCBindingContainer bc) {
    this.bindingContainer = bc;
    public DCBindingContainer getBindings() {
    return bindingContainer;
    //I just threw this method on there in case I was missing something & I also
    //tried using a getBindingContainer method above but that didn;t work.
    public void setBindings(DCBindingContainer bindings) {
    this.bindingContainer = bindings;
    adf-faces.conf entry
    <managed-bean>
    <managed-bean-name>backing_VunerabilityDetail</managed-bean-name>
    <managed-bean-class>viewcontroller.backing.VunerabilityDetail</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>bindingContainer</property-name>
    <property-class>oracle.adf.model.binding.DCBindingContainer</property-class>
    <value>#{bindings}</value>
    </managed-property>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1VunerabilityDetail.jsp-->
    </managed-bean>

  • Howto: Iterate ADF BC from a managed bean from the View?

    Hi Everyone,
    I've been trying to iterate a BC ADF object from a managed bean from the view layer. Here is what I have done so far, but I don't seem to get any records:
    In faces-config.xml, I am passing in the BindingContext to the managed bean. (This is a session scoped bean).
    <managed-property>
          <property-name>bindings</property-name>
          <property-class>oracle.adf.model.BindingContext</property-class>
          <value>#{data}</value>
        </managed-property>In the testPageDef.xml I have the executables and bindings setup:
      <executables>
        <iterator id="TestRO1Iterator" RangeSize="-1" Binds="TestRO1"
                  DataControl="ApplicationControlDataControl"/>
      </executables>
      <bindings>
        <table id="TestRO1" IterBinding="TestRO1Iterator">
          <AttrNames>
            <Item Value="C1"/>
            <Item Value="C2"/>
          </AttrNames>
        </table>
    </bindings>In my managed bean, in addition to the accessors for the bindingContext of bindings, I have:
                 BindingContainer bc = getBindings().findBindingContainer("testPageDef");
                 ControlBinding cb = bc.getControlBinding("TestRO1");
                 RangeBinding rb = (RangeBinding)cb;
                 List testList = rb.getRangeSet();
                 Iterator testIter = testList.iterator();
                 int testCount = testList.size();
                 while (testIter.hasNext()) {
                   Map attrs = (Map)testIter.next();
                   System.out.println(attrs.get("C1")+","+attrs.get("C2"));     
                   //Do some fancy stuff here with the values.
                 }However, my testList.size() always returns 0.
    Is this the right method to programatically access the data from the view layer from a managed bean, or have I missed something completely? Are there any working samples that I could take a look at?
    Jdev: 10.1.3.1
    Thanks!
    Kenton

    Hi,
    <managed-property>
    <property-name>bindings</property-name>
    <value>#{bindings}</value>
    </managed-property>
    private BindingContainer bindings= null;
    public void setBindings(BindingContainer bc){
    bindings = bc;
    public BindingContainer getBindingContainer(){
    return bindings;
    DCIteratorBinding dciter = (DCIteratorBinding ) bc.get("TestRO1Iterator");
    RowSetIterator rsi = dciter.getRowSetIterator();
    while (rsi.hasNext()){
    Row rw = (Row) rsi.next();
    //Do some fancy stuff here with the values.
    You find several examples in the developer guide and on the Internet
    Frank

  • ADF Show popup from managed bean

    Hi, i have one popup in jspx. On click of a command button a method in managed bean should be called and that has to decide whether to show the popup or not. I have a check and using that i need to show this popup. How to show/invoke the popup from managed bean? I used script also but it was not working. Kindly help me.
    Thank you,
    Sankari Kannan

    Hi,
    Which JDeveloper Release You Use?
    In JDeveloper11g the structure View---->Document----->Form.
    Try one of these solutions:
    - Try to put it outside of your pageTemplate tage as:
    <af:view>
    <af:popup>
    </af:popup>
    <af:pageTemplate>
    <f:facet>
    <af:decorativeBox>
    <af:view>
    I don't know is it possible or not.
    - you can put the ids of your popup container as
    StringBuilder strb =
    new StringBuilder("AdfPage.PAGE.findComponent(\"container1:container2:popup5\").show();");
    Sameh Nassar

  • How could i use resource bundle in managed bean instead of harding coding?

    component is created in managed bean programmatically, so how to set attributes(e.g. text, value) using resource bundling instead of hard coding, as like coding on the page directlly?
    Thanks for your help!
    Kevin.

    component is created in managed bean programmatically, so how to set attributes(e.g. text, value) using resource bundling instead of hard coding, as like coding on the page directlly?
    Thanks for your help!
    Kevin.

  • How to expose UI components in a managed bean?

    Dear all
    I created a jsf page without exposing UI components in managed beans.
    And the page is created successfully.
    But now I want to expose UI components in managed beans again
    How to make this??
    Please help

    select your component in Jdeveloper main menu, in the property inspector find Binding property -->click Edit to bind this component to a managed bean property.

  • Setting bind variable for a view object from the Managed Bean

    Hi,
    i am using JDeveloper 11g, i have to create LOV in the JSF. To show the LOV, it has to populate data using View object and its query parameter need to be sent from the Managed Bean.
    For the View object i want to set the bind variable parameter from the managed bean value. bename is stored in a managed bean (session scope)
    #{beantest.bename}
    But it gives the following exception.
    JBO-29000: Unexpected exception caught:
    org.codehaus.groovy.control.MultipleCompilationErrorsException,msg=startup failed, Script1.groovy: 1: expecting '!',found '{'@ line1, column 2.
    I have followed the link http://kr.forums.oracle.com/forums/thread.jspa?threadID=615474 like Frank wrote on 8.2.2008:
    But steps are not clear.
    How to input the VO bind parameter with Managed bean variable?
    Any Help
    Regards
    Raj
    Edited by: user9928180 on Dec 17, 2008 9:51 AM

    Hi,
    a bind variable in a VO needs to be exposed as an executeWithParams operation in the pageDef file. Just add a new action binding to the pageDef file (context menu) and select the executeWithParams operation on teh VO. Then in the argument field, reference the managed bean property for the value
    Frank

  • I want to get a adf component in managed bean with jsff. What can I do?

    I want to get a adf component using FacesContext.getCurrentInstance().getViewRoot().findComponent("my component id").
    It's ok in taskflow with jspx, but I can't get the component correctly in my managed bean in taskflow using page fragment.
    The error is "can not find view root".

    What features do you need in the discussion board and how big do you forecast the community to be?
    I gather that you really want a free solution.
    No software is perfect but when you pay for software you generally get features and the expectation of a certain minimum level of support.
    With open source, you get free, features and some support but you also get constant security fixes, regular update patches, plus lots of trawling through online forums looking for tweaks and workarounds. Expect to invest lots of time maintaining it.
    I've used phpBB in the past but never had issues with DW touching the coding. It served its purpose for me and the community at the time but the issues I dealt with regularly were the constant updates/bugfixes and never ending spam, spam, spam.

  • Show Popup From Managed Bean

    Hi,
    how i show a inline popup from managed bean , triggered by a certain action in bean, like satisfying a condition or something else?
    normally, showing a popup from bean involves clicking some userinterface components on page.
    in my case, showing a popup should totally automated by a managed bean.
    i m using jdev 11.1.1.2 .
    Plz , help me in this context.
    Regards,

    Hi John,
    I used the above code but it doesnt work.Can you please look into my code.
    In Jspx page,
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1" binding="#{backingBeanScope.backing_untitled5.d1}">
    <af:form id="f1" binding="#{backingBeanScope.backing_untitled5.f1}">
    <af:commandButton text="commandButton 2"
    binding="#{backingBeanScope.backing_untitled5.cb2}"
    id="cb2"
    action="#{backingBeanScope.backing_untitled5.cb2_action}"/>
    </af:form>
    <af:popup binding="#{backingBeanScope.backing_untitled5.p1}" id="p1">
    <af:panelWindow binding="#{backingBeanScope.backing_untitled5.pw1}"
    id="pw1"/>
    </af:popup>
    </af:document>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_untitled5-->
    </jsp:root>
    In backing bean,
    package view.backing;
    import javax.faces.context.FacesContext;
    import oracle.adf.view.rich.component.rich.RichDocument;
    import oracle.adf.view.rich.component.rich.RichForm;
    import oracle.adf.view.rich.component.rich.RichPanelWindow;
    import oracle.adf.view.rich.component.rich.RichPopup;
    import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
    import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
    import org.apache.myfaces.trinidad.util.Service;
    public class Untitled5 {
    private RichForm f1;
    private RichDocument d1;
    private RichPopup p1;
    private RichPanelWindow pw1;
    private RichCommandButton cb2;
    public void setF1(RichForm f1) {
    this.f1 = f1;
    public RichForm getF1() {
    return f1;
    public void setD1(RichDocument d1) {
    this.d1 = d1;
    public RichDocument getD1() {
    return d1;
    public void setP1(RichPopup p1) {
    this.p1 = p1;
    public RichPopup getP1() {
    return p1;
    public void setPw1(RichPanelWindow pw1) {
    this.pw1 = pw1;
    public RichPanelWindow getPw1() {
    return pw1;
    public void setCb2(RichCommandButton cb2) {
    this.cb2 = cb2;
    public RichCommandButton getCb2() {
    return cb2;
    public String cb2_action() {
    // Add event code here...
    FacesContext context = FacesContext.getCurrentInstance();
    ExtendedRenderKitService extRenderKitSrvc =
    Service.getRenderKitService(context, ExtendedRenderKitService.class);
    extRenderKitSrvc.addScript(context,"AdfPage.PAGE.findComponent('" + p1 + "').show();");
    return null;
    Please correct my mistake if any.
    Regards,
    Tom

  • Using Managed bean

    Hi All,
    How to use managed bean instead of backing bean to retreive a value from a object.
    a)Say in my form i have selectoneChoice box and i need to retreive the value inputed by the user
    b)According to the value selected by the user i need to show a tick mark or cross mark. Is it possible.
    Am using ADF 11g
    Please guide me how to acheive this.
    Thanks in Advance

    Your backing bean can access the bindings object and get the value of the attribute from there in your code.
    Lots of code samples for this here:
    http://biemond.blogspot.com/2009/03/some-handy-code-for-backing-beans-adf.html
    For list binding there is a little trick though:
    http://www.oracle.com/technetwork/developer-tools/jdev/listbindingvalue-088449.html
    I would also suggest that you watch the seminars about binding in the ADF Insider series:
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfinsider-093342.html

  • JSF - Best Practice For Using Managed Bean

    I want to discuss what is the best practice for managed bean usage, especially using session scope or request scope to build database driven pages
    ---- Session Bean ----
    - In the book Core Java Server Faces, the author mentioned that most of the cases session bean should be used, unless the processing is passed on to other handler. Since JSF can store the state on client side, i think storing everything in session is not a big memory concern. (can some expert confirm this is true?) Session objects are easy to manage and states can be shared across the pages. It can make programming easy.
    In the case of a page binded to a resultset, the bean usually helds a java.util.List object for the result, which is intialized in the constructor by query the database first. However, this approach has a problem: when user navigates to other page and comes back, the data is not refreshed. You can of course solve the problem by issuing query everytime in your getXXX method. But you need to be very careful that you don't bind this XXX property too many times. In the case of querying in getXXX, setXXX is also tricky as you don't have a member to set. You usually don't want to persist the resultset changes in the setXXX as the changes may not be final, in stead, you want to handle in the actionlistener (like a save(actionevent)).
    I would glad to see your thought on this.
    --- Request Bean ---
    request bean is initialized everytime a reuqest is made. It sometimes drove me nuts because JSF seems not to be every consistent in updating model values. Suppose you have a page showing parent-children a list of records from database, and you also allow user to change directly on the children. if I hbind the parent to a bean called #{Parent} and you bind the children to ADF table (value="#{Parent.children}" var="rowValue". If I set Parent as a request scope, the setChildren method is never called when I submit the form. Not sure if this is just for ADF or it is JSF problem. But if you change the bean to session scope, everything works fine.
    I believe JSF doesn't update the bindings for all component attributes. It only update the input component value binding. Some one please verify this is true.
    In many cases, i found request bean is very hard to work with if there are lots of updates. (I have lots of trouble with update the binding value for rendered attributes).
    However, request bean is working fine for read only pages and simple binded forms. It definitely frees up memory quicker than session bean.
    ----- any comments or opinions are welcome!!! ------

    I think it should be either Option 2 or Option 3.
    Option 2 would be necessary if the bean data depends on some request parameters.
    (Example: Getting customer bean for a particular customer id)
    Otherwise Option 3 seems the reasonable approach.
    But, I am also pondering on this issue. The above are just my initial thoughts.

  • Sharing managed beans

    Ok �. This is driving me nuts. I�m relatively new to JSF (2 week profession &#61514; ), and I may not have grasped the concept of Managed Beans. The problem is detailed below:
    Development Environment:
    WebSphere Studio 1.5.2 � This creates a backing bean for each respective JSP page that is created, including setters and getters for each managed bean. The two backing beans I�ll talk about whilst specifying the problem are stored in session scope.
    The Problem:
    I can�t share data between two pages. On the first page I create managed bean in session scope and make this reusable (let�s say person). On the second page I add the reusable Person bean. The resulting entry in the faces.config file is:
    <managed-bean>
    <managed-bean-name>person</managed-bean-name>
    <managed-bean-class>ibm.wlrs.model.PersonVO</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    Both pages however maintain an independent copy of the managed bean instead of JSF maintaining a shared one. I�ve looked at several documents, and too me it seems as though this bean should be shared between the two pages�� HELP!
    On the first page I create a new Person object with the relevant details. This person is created upon a button click added to the backing beans managed bean.
    //Page 1 add person from button click
    public String doLnkInsertEntryAction() {
    System.out.println("Insert");
         Person p1 = new Person();
         p1.setName("Duncan");
         setPerson(p1);
    System.out.println(getPerson().getName());
    //This prints the person�s name
         return "insert";
    I have also setup a page load event to test that the person object stays in the session
    //Page 1 page load
    public void onPageLoadBegin(FacesContext facescontext) {
         System.out.println(getPerson().getName());
    //Prints the person name that was added during the button click event� on Postback or even after going from page1 � page2 and back again.
    On Page two if I try and access the managedBean contained within the session, the �name� will always print out as null.
    //Page 2 page load
    public void onPageLoadBegin(FacesContext facescontext) {
         System.out.println(getPerson().getName());
    If I add an any information to the managed bean on page two i.e. person.setName(�Another�), this data stays in the session, only for page two though.
    Is this how JSF is supposed to work? I though if a managed bean was stored in the session, the object (and it�s data) should be reusable between pages.
    Sorry for the long post�. I though it would be worth while to try and be as specific as possible.
    Thanks
    Duncan

    And� I still don�t understand why two independent
    copies are kept by the pages�Because YOU create the copy.
    JSF (exactly speaking the default VariableResolver) at first searches for an attribute in
    request scope, then session scope, then application scope with the matching name.
    Only when no attribute is found, it examines faces-config.xml, creates an instance of
    the specified class, and stores the instance in the specified scope.
    It never creates two instances with a same name.
    I.E� On Page 1�. Several Person objects are stored in
    a DataTable. The Vector containing the Person objects
    is a managed bean bound to this data table. Upon a
    button click I require to extract a person from the
    data table and place it into the managed bean session
    scope for person. Humm, I guess you misunderstand what the managed bean is.
    h:dataTable has the "var" attribute which is used to refer each Person object.
    JSF implements the "var" variable as a request scope attribute and re-binds it
    to each Person object in the iteration. So, it is not a managed bean but is simply an attribute.
    The entry of faces-config.xml is not required.
    To know how to pass the selected row data to the next page, please see some
    example using h:dataTable and javax.faces.model.DataModel.

  • Pageless Managed beans and operation bindings, design question

    Hi,
    I am using ADF Faces and ADF BC and JDev 10.1.3.
    I want to declaratively execute an operation binding from a managed bean which does not have a page definition.
    How can I create a page definition for a managed bean which will allow me to define and call operation bindings in the same way that you can in a backing bean?
    In the past I have used the binding layer to get references to the AM and then execute the client methods directly.
    How can I do this declaratively from a managed bean?
    regards,
    Brenden

    Hi Steve,
    a good example would be a managed bean which is used by many pages for provide dynamic page forwarding (using global forwards).
    The page forwarding is based on what data the user has selected and the entry tasklist will have pages added and removed based on the users entered information.
    At the moment I use references in the managed bean which get the binding context by evaluating #{data} to get a reference to the AM and directly call an client method, which calls a PL/SQL procedure and returns a global forward string. The AM is imported into the managed bean and methods called directly.
    This is just one example, but probably the best I can come up with for now.
    In a backing bean I can use an operation binding to call a method and get a result declaratively like this:
            BindingContainer bindings  = getBindings();
            OperationBinding operation = bindings.getOperationBinding("getUserByEmail");
            operation.getParamsMap().put("email", email);
            String userName = (String)operation.execute();whereas in a managed bean I have to get direct references to the AM to call the method directly.
    if there is a way to do this in the same way as backing beans it would seem a more abstracted and cleaner approach?
    regards,
    Brenden

  • How to add property through managed-beans.xml

    Hi,
    I am trying to take a hard coded value property from managed-beans.xml file. I tried using :
    <managed-property>
    <property-name> filename </property-name>
    <value> xx </value>
    I called getProperty("filename"); from one of my bean classes and it did not recognise it.
    I am not sure how to do this one. any help will be appreciated.
    Thanks

    I'm not sure what getProperty method you are referring to in your original posting. Is this a method on your managed bean class?
    Managed beans are implemented as regular JavaBeans so you will need to add a setFilename(String) and getFilename() method to your backing bean class to get this to work correctly. The setter method will get called automatically when the bean is first instantiated, either by accessing it from a JSP value-binding expression as a result of calling context.getApplication().getVariableResolver().resolve(context, beanName) where context is an instance of FacesContext and beanName the name of the managed bean as specified in faces-config.xml. You can then use the getter method to access the property value from within your application code.
    Alternatively, if you don't want to implement a JavaBean class, you can specify java.lang.HashMap as the managed bean class and use myBean.get("filename") to access the property instead.
    Hope this helps.
    -- Keith

  • Get component Id in managed bean

    Hi experts,
    I am going to ask a foolish question, but since i'm a newbie i hope you'll forgive me .
    I am using JDev version: 11.1.2.3.0. My question is: Is it possible to get a component id inside a managed bean? By components i mean, buttons or menu items. The scenario i would like to create is this:
    I am using JasperReports to generate some required reports. I would like to do something like having a Menu with different items. By clicking each one of them, set a string in the managed bean i'm using to generate the reports (actually the string would be the name of the jrxml file i am going to load). And this string would get it's value based on which menu item is selected.
    Is it possible to do such a thing? Or may be some other way would be more suitable?
    Thank you in advance!

    MenuRenderer  is a class that renders the current value of
      UISelectOne  or  UISelectMany  component as a list of
       menu options and makes use of getId.
    https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCwQFjAA&url=http%3A%2F%2Fjava.net%2Fprojects%2Fmoja…

Maybe you are looking for

  • Document not Posted Trip cannot be changed Error

    Hi all,         I have an issue where user is facing problem while creating Expense report for his expenses. when he tries to create he gets this Error message   "Accounting Status not 'Document posted' Trip cannot be changed". But user was creating

  • Why can't my MacBook open .Jar files?

    Hi, Whenever I try to open a .jar file, I get this error message: I really need to be able to open .jar files. I have been able to open them in the past; I really don't know what happened. Java is up to date. Everything is up to date. Java settings i

  • Photoshop - Printing RAW Images

    Hi, I am trying to print RAW file images in photoshop.  The image appears on my iMac exactly the same as the camera.  It is printing completely different. I did a printer check and the printer is fine.  I printed other images from Photoshop and they

  • No puedo instalar aplicaciones en iPhone 3 g

    No se qué pasa que no puedo instalar aplicaciones en mi iPhone 3 g me dice que no son soportadas por el iOS 4.2.1 después de resetea rol . Alguien me puede ayudar? No me puedo creer que apple deje inactivos los teléfonos simplemente para obligarnos a

  • Please help me Pages 5.2

    Non riesco a collegare le caselle di testo, non hanno più il triangolino sul lato! come posso fare? Pages 5.2 I can not link text boxes, no longer have the triangle on the side! how can I do? Pages 5.2