Forum Stats

  • 3,852,024 Users
  • 2,264,055 Discussions


How to control Region's visibility on page load?

Murat Şener
Murat Şener Member Posts: 32
edited Aug 22, 2016 3:13AM in JDeveloper and ADF


I have one SOC and one Region on my page.

SOC has Contact Lists on it which get these lists from DB.

Roles are assigned to Contact Lists, if user has right to see selected Contact List(if user in role), region gets visible.

I use ValueChangeListener property of SOC to set region visible or invisible.

It works well if any value change event of SOC happens.

The problem is that i cant control visible property on page load as no value change event.

I want to set region visible if user has right to see SOC's first value,first Contact List on the SOC, on page load.

I use JDev version.

Do you guys tell me if there is way to control User's right and set visibility of Region accordingly on page load?

Many thanks in advance!


Ajay Taneja

Best Answer



  • codigoadf
    codigoadf Member Posts: 667
    edited Aug 18, 2016 5:09AM


    you can use a lot of ways. you can put the region rendered false and add a firt value in the soc (no selection or blank item),render region based in the value of SOC, or maybe a complex way could be secure the region with adf security

  • SanjeevChauhan
    SanjeevChauhan Member Posts: 1,554 Gold Trophy
    edited Aug 18, 2016 5:58AM

    Assuming that you have a task-flow (say parentTF) and on which you have a jsff (say parentJsff). On jsff you are using SOC and another task-flow. Using SOC you want to control visibility of task-flow (say childTF). Most probably you may want to pass SOC value to your second task-flow.

    1. Add an activity (may be AM method call) in parentTF and in front of parentJsff. Its aim is to determine if user has access to first SOC value. Determine it separately in AM and return it. Set output for this activity and store it in pageFlowScope.

    2. Set activity condition for childTF based on pageFlowScope variable. This will solve your usecase of initial rendering of task-flow. I would suggest using activation for initial rendering as if you use rendered/visible of task-flow your flow will still run unnecessary. Only thing it will not be visible in UI. Better not to start it at all.

    3. Add valueChangeEvent for SOC as you are doing and do rest of stuff as you are already doing.

    I would even suggest you to go for dynamic region and show a blank region if user does not have privilege. It would make sure that actual complex task-flow only runs when you need it. Replace it with a blank task-flow with single blank page if user does not have access.

    Alternatively introduce a blank page in your taskflow (childTF) and using router take user that that blank page if he does not have access to SOC. Your childTF can take SOC value as input and make decision itself if user has access or not. Based on access router can take him to blank page.

    Security might not help here as using ADF security you will either get access or not get access on a TF. In your case you need to check access based on SOC value selected. ADF security might not be able to use that SOC value while trying to resolve security.



    Murat Şener
  • Murat Şener
    Murat Şener Member Posts: 32
    edited Aug 18, 2016 6:39AM

    Many thanks for your quick replies guys.


    When i use rendered property, results are same just like visible property.

    I did try to add Unselectedlabel to SOC, it works well as it make user to trigger value change event.

    But this time it gives error message if user select Unselectedlabel message from drop down.


    Yes i have a task flow and there is only one jsff file on it.

    And yes i already use dynamic region on my page.

    If user select 1st item from SOC it goes a different TF else it goes another TF.

    I can use blank task flow if user doesnt have privilege, but in my case i dont know how to route them without a value change event on SOC.

    I am new in ADF so my question looks stupid but many thanks for your help anyway!


  • Ajay Taneja
    Ajay Taneja Member Posts: 1,413 Bronze Trophy
    edited Aug 18, 2016 6:51AM


    You can create a binding for TF and in getter of it you can set it false and this should work when your page is getting prepared i meant during lifecycle and it will work during page load.


  • Murat Şener
    Murat Şener Member Posts: 32
    edited Aug 18, 2016 8:59AM


    I couldnt understand. how can we bind TF? In my case i dont want to control case with tfs. I prefer to use Visible property.

    And also i tried use Method Call to control case before page load.

    Page isnt be loaded if i try to set Region visibility with rgRegion.setVisible(true) in my method call.

    Is there a way to set jsff page component's properties from method call?

    Thank you

  • SanjeevChauhan
    SanjeevChauhan Member Posts: 1,554 Gold Trophy
    edited Aug 18, 2016 9:11AM

    There are 3-4 ways to do activity at page load

    1. Most preferrable: Before coming to the page it self add an activity in task-flow. Derive values in that activity. Use those values in your page. For example there is button I want to show hide it based on some query. I will write an AM method which returns as String Y or N. Y if user can see button, N if user can't see button. Logic is buried in AM. I will expose this AM method and then drop it on task-flow just before the page. Return parameter of this activity I will set as #{pageFlowScope.pShowMyButton}. Once activity is completed output of AM method is available in pageFlowScope. Then I will have page. In that page I will write rendered property of button as rendered="#{pageFlowScope.pShowMyBytton == 'Y'}. That way button is only shown if pShowMyButton is Y in pageFlowScope.

    In your case you need to write an AM method which will get first value of SOC and try to figure out if user has access to that first value. Based on that return Y or N. Drop this AM method in parentTF just before the page which contains SOC. Set its return as #{pageFlowScope.pRenderMyFlow}.

    Now in your page which has SOC, you will have childTF as a region. Go to binding of this parentPage and edit task-flow binding. That is where you have made it dynamic task-flow. Consider pageFlowScope.pRenderMyFlow also while determining which task-flow to render. Actual or Dummy.

    Other ways could be

    2. Phase Listener

    3. A hidden text with getter/setter. Code is inside getter.

    For you I believe most suitable is first option.



    Ajay TanejaMurat Şener
  • Murat Şener
    Murat Şener Member Posts: 32
    edited Aug 19, 2016 6:16AM

    Hi Sanjeev,

    Many thanks for your help!

    I tried to try first option.

    Page isnt being loaded if i try to add return value to method call.

    I can see in debug mode that the method returns Y.

    What i am doing wrong here?

    Below is method call snippet:

    <method-call id="isUserYetkili">


          <return-value id="__13">#{pageFlowScope.RehberBilgileriYonetim.pGoster}</return-value>

          <outcome id="__6">




    Here is AM method:

        public String isUserYetkili(){


            List<String> listOfRoles = new ArrayList<String>();

            ViewObjectImpl vo = getRehberYonetimRolViewInsDefault();

            Row[] filteredRows = vo.getFilteredRows("TypeId", 1);

            for(Integer i=0;i<filteredRows.length;i++){




            for(String rol:listOfRoles){


                 * i ll use this on live


                    return "Y";




                    return "Y";





            return "N";


    And TF diagram:

    tf diagram.PNG

  • Ajay Taneja
    Ajay Taneja Member Posts: 1,413 Bronze Trophy
    edited Aug 19, 2016 6:27AM

    Your method outcome should be 'isUserYetkili' for it to navigate matching with control flow case.


  • ManishPandey
    ManishPandey Member Posts: 1,722 Silver Trophy
    edited Aug 19, 2016 6:53AM


    what i  understood you are using application module method as method call activity on your taskflow.

    and your method return "Y" or "N".

    but your control flow defined if method return value is "isUserYetKili" then navigate to the page.

    1.Create a method on managed bean and use this method as method call activity.(to check how to create method call activity Using Method Call Activity to open form on Insert Mode | ADF Tutorials )

    2.Then call your application module method on your method call activity as follows

            BindingContext bindingctx = BindingContext.getCurrent();

    BindingContainer binding =bindingctx.getCurrentBindingsEntry();

    OperationBinding quesid =binding.getOperationBinding("isUserYetKili");


    String result=(String)quesid.getResult();// it's return either "Y" or "N".

    3. set the value of result to pagFlowScope

                AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();

                Map pageFlowScope = adfFacesContext.getPageFlowScope();

    pageFlowScope.put("isValid", result);

    4. then always return "isUserYetKili" from your manage bean method call activity method.

    5.finally you can use render property like

    rendered="#{pageFlowScope.isValid== 'Y'}

    Murat Şener
  • Murat Şener
    Murat Şener Member Posts: 32
    edited Aug 19, 2016 6:59AM

    it is actually working well if i don't use return value for method call.

    I need to return Y or N as Sanjeev mentioned above.

    So how can i do that in another way?

This discussion has been closed.