This discussion is archived
8 Replies Latest reply: Jan 30, 2013 2:46 AM by 988039 RSS

JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.

Steven Zorb Newbie
Currently Being Moderated
I am using the code below from the Favorite Fruits ADF shuttle component training video that is available on the web:

public static List<SelectItem> selectItemsForIterator(String iteratorName,
String valueAttrName,
String displayAttrName) {
BindingContext bc = BindingContext.getCurrent();
DCBindingContainer binding =
(DCBindingContainer)bc.getCurrentBindingsEntry();
DCIteratorBinding iter = binding.findIteratorBinding(iteratorName);
List<SelectItem> selectItems = new ArrayList<SelectItem>();
for (Row r : iter.getAllRowsInRange()) {
selectItems.add(new SelectItem(r.getAttribute(valueAttrName),
(String)r.getAttribute(displayAttrName)));
}
return selectItems;
}

The call to getCurrentBindingsEntry() returns null.

Can someone advise me what would cause this function to return null?

Thank you, Steve
  • 1. Re: JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.
    Puthanampatti Guru
    Currently Being Moderated
    use ADFUtils, no need to have that much code...

    DCIteratorBinding iterator =
    ADFUtils.findIterator("OraderVOIterator");
    Row[] fetchRows = iterator.getAllRowsInRange();
  • 2. Re: JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.
    SantoshVaza Expert
    Currently Being Moderated
    Hi,
    The call to getCurrentBindingsEntry() returns null.
    do you page have pageDef file..
    right click your page and select "Goto page defination" ......
    check whether you have proper pageDefination in databindings.cps file
  • 3. Re: JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.
    Steven Zorb Newbie
    Currently Being Moderated
    I have a task flow that has one managed pageflow scope bean and one .jsf. The .jsf does have a pageDef. I am confused as to what getCurrentBindingsEntry() is doing. I could have multiple .jsf in my task flow; some with pageDef files and some without. Which .jsf pageDef is it trying to hook to?

    Also, what is the correct way to import the ADFUtils and JSFutils into my application? I have the .java files. I tried to include them by creating a package under ViewController/Application Sources. In the package I created two .java files and cut and paste the ADFUtils and JSFUtils files into the new .java files. Clearly this is NOT the way to do it. it gave me a load of compile errors, permanently locked the .lok file and created some files/directories with names that were a mile long. I could not even make a copy of my application directory because some file names were too long. Fortunately, I keep backup copies of my application; I restored the latest good copy and I am good to go.

    Thanks, Steve
  • 4. Re: JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.
    Steven Zorb Newbie
    Currently Being Moderated
    I used the ADFUtils functions to attempt to get binding. The results I see are below. I do have a pageDef file for my .jsf. The bindings look normal via the .jsf 'Bindings' tab.

    Can someone give advice?

    Thanks, Steve



    // This returns null
    DCBindingContainer bc = ADFUtils.getDCBindingContainer();


    // This returns null
    public static DCBindingContainer getDCBindingContainer() {
    return (DCBindingContainer)getBindingContainer();
    }


    // This returns null
    public static BindingContainer getBindingContainer() {
    return (BindingContainer)JSFUtils.resolveExpression("#{bindings}");
    }


    // This returns null
    public static Object resolveExpression(String expression) {

    // Success
    FacesContext facesContext = getFacesContext();
    // Success
    Application app = facesContext.getApplication();
    // Success
    ExpressionFactory elFactory = app.getExpressionFactory();
    // Success
    ELContext elContext = facesContext.getELContext();
    // Success
    ValueExpression valueExp =
    elFactory.createValueExpression(elContext, expression, Object.class);

    // At this point
    // elContext.toString is: com.sun.faces.el.ELContextImpl@1f7d59
    // valueExp.toString is: ValueExpression[#{bindings}]

    // This returns null
    return valueExp.getValue(elContext);
    }
  • 5. Re: JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.
    Steven Zorb Newbie
    Currently Being Moderated
    I believe that the reason getCurrentBindingsEntry() returned null is that I was calling it in a page flow scope managed bean. The JavaDoc for getCurrentBindingsEntry() indicates that it must be in request scope. This makes sinse because the page flow managed bean would not necessarilyl be associaged with a particular page or its bindings.

    Is this correct?

    Thanks, Steve
  • 6. Re: JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.
    909892 Newbie
    Currently Being Moderated
    Hi Steve, I am not sure if the issue is related to the scope of the bean because I am using the same method in pageFlowScope beans without a problem. However, I just ran into the same problem you are experiencing today. The problem in my case was that my BTF's default activity was a method call which was attempting to call getCurrentBindingsEntry. I changed the default activity to a view and then called getCurrentBindingsEntry in the constructor of the bean. This resolved the issue. Could it be that you have a similar situation?

    Dar.K
  • 7. Re: JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.
    Steven Zorb Newbie
    Currently Being Moderated
    Dar.K

    I get the same results as you. It does not work if called from the method set as default activity. It also does not if called from the method set as the btf initializer. It only seems to work if called from the btf constructor.

    What would this code return if the btf has multiple pages. Which page binding would this return?

    BindingContext bc = BindingContext.getCurrent();
    DCBindingContainer binding = (DCB indingContainer)bc.getCurrentBindingEntry();

    Thanks for your help, I can move forward, Steve
  • 8. Re: JDev 11.1.2.1 bc.getCurrentBindingsEntry() returns null.
    988039 Newbie
    Currently Being Moderated
    check file task_flow_name...PageDef.xml exist

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points