This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,552 Users
  • 2,269,776 Discussions


How to call partial trigger on JSFF component from separate managed bean?

eevictim Member Posts: 319
edited Nov 18, 2010 5:00AM in JDeveloper and ADF
Guys and Gals,

Using JDev Looked on the forums and google. Initial results aren't so great.

Is it possible to call a PPR on a JSFF component from a separate managed bean? It seems calling the FacesContext in this instance calls the root JSPX, which only contains one child: the RichDocument.
      UIComponent component =
      if (component != null)
         AdfFacesContext context = AdfFacesContext.getCurrentInstance();
Returns 1 :(

Ideas for a workaround?

Edited by: LovettWB on Nov 17, 2010 3:39 AM

Edited by: LovettWB on Nov 17, 2010 4:11 AM

Edited by: LovettWB on Nov 17, 2010 4:12 AM

Best Answer


  • eevictim
    eevictim Member Posts: 319
    If not possible, refreshing the entire JSFF would work. This refresh request is being sent from a managed bean connected to a dialog from within the JSFF. i.e. I'm not refreshing a region on a page, but the JSFF itself.
  • Joonas Linkola-Oracle
    Joonas Linkola-Oracle FinlandMember Posts: 277

    Bind the component to the managed bean first (in component inspector Advanced > Binding), JDeveloper will create the getter/setter methods for you automatically. After that you can call AdfFacesContext.getCurrentInstance().addPartialTarget(propertyName) to refresh the component.


    Joonas Linkola-Oracle
  • eevictim
    eevictim Member Posts: 319
    My component is in another, separate, managed bean.

    partTable is in bean TableCollectionListeners

    My PPR is being called from DialogCollectionListeners

    In this instance, how would I grab the handle for the component (partTable) so my DialogCollectionListener bean could "see" it for the AdfFacesContext.getCurrentInstance().addPartialTarget(propertyName)? I thought the ....findComponent("pc1:table1"); command would work, but it doesn't seem to find it.

    I apologize. Should have cleared that up in my previous post.
  • Joonas Linkola-Oracle
    Joonas Linkola-Oracle FinlandMember Posts: 277
    Answer ✓
    Then maybe this post will help (assuming your fragment is added to the page as a region):
  • eevictim
    eevictim Member Posts: 319
    Looks promising! Thank you for your reply. I'll check it out in the morning, and let you know how it goes. I'm pooped!
  • eevictim
    eevictim Member Posts: 319
    Thanks! Joonas, you've been a great help.

    The code on the page you referenced was close, but the code on a page referenced in the user comments was even better:

    My region is located in a facet, which the page you posted doesn't quite cover, but the page above fixed that. Here's the fix below:

    In Managed Bean
          // search for the region ID (or task flow) in the base page
          UIComponent base = jsfUtils.findComponentInRoot("dynamicRegion");
          // now find component ID from within that region
          UIComponent partTable = jsfUtils.findComponent(base, "partTable");
          // call PPR on your found component
    In JSFUtils utility class
       // used to locate region.  Could also find any component
       // located in the base ViewRoot()
       public static UIComponent findComponentInRoot(String id) {
        UIComponent component = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
          UIComponent root = facesContext.getViewRoot();
          component = findComponent(root, id);
        return component;
        // Recursive method which finds your component within JSFF
        // regardless of facet or other UIComponents which may have children
    public static UIComponent findComponent(UIComponent base, String id) {
        if (id.equals(base.getId()))
          return base;
        UIComponent kid = null;
        UIComponent result = null;
        Iterator kids = base.getFacetsAndChildren();
        while (kids.hasNext() && (result == null)) {
          kid = (UIComponent);
          if (id.equals(kid.getId())) {
            result = kid;
          result = findComponent(kid, id);
          if (result != null) {
        return result;
    Good stuff to know!
  • eevictim
    eevictim Member Posts: 319
    One more thing.

    To do an effective search on a component ID, I believe you have to manually change the component's ID. If you let ADF assign the ID, there's no telling what the ID will become at runtime, which makes for an uncertain search outcome.
  • Joonas Linkola-Oracle
    Joonas Linkola-Oracle FinlandMember Posts: 277
    Glad to hear you got it working!

    You're safe with JDeveloper generated component IDs (pc1, t1 etc.), but may run into problems if you don't have IDs assigned at design time at all (in which case they get generated at runtime).
    Joonas Linkola-Oracle
This discussion has been closed.