Search code examples
javaoracleoracle-adfjdeveloperoracle-fusion-middleware

How can I get returned value from function in .jsf page adf 12c?


I am calling a function on page load (.jsf page programmatically) and it's working fine, but function is returning (0 or 1) string value. I want to show or hide buttons based on returning value in jsf page.

How can I get returning value on .jsf page?

How can I apply logic of show and hide based on returning value?

Here is how I am calling function on page load

<f:metadata>
        <?audit suppress oracle.ide.xml.validation-error?>
        <f:event type="preRenderView" listener="#{backingBeanScope.backing_login.viewPrivilidge('Program')}"/>
</f:metadata>

Here is the code of button on which i want to apply logic

 <af:button text="Supplier" id="b4" inlineStyle="width:190px;"
            destination="Supplier_Setup.jsf" icon="#{resource['images:supplier.png']}"/> 

I am using .jsf page in adf 12c.


Solution

  • only you need to call function in render attribute of that tag where you want to apply logic

    <af:button text="Supplier" id="b4" inlineStyle="width:190px;"
                rendered="#{backingBeanScope.backing_login.viewPrivilidge('Program') == '1'}"           destination="Supplier_Setup.jsf" icon="#{resource['images:supplier.png']}"/> 
    

    "#{backingBeanScope.backing_login.viewPrivilidge('Program') == '1'}" .......... if your returning value is equal to '1' then it will render otherwise it will not render