Tuesday 2 June 2015

OAF: Spel Binding

Simplest Possible Expression Language (SPEL) - An industry-standard expression language included in the JSP Standard Tag Library (JSTL)

For selected properties, OA Framework supports the use of SPEL expressions to quickly bind the property to an underlying data source that provides the property's value. For example, you could bind the Rendered property of a button to a view object attribute to ascertain whether it should be hidden or shown when the page renders.

The SPEL syntax for this property looks like:
   ${oa.<ViewInstanceName>.<ViewAttributeName>}
       
      eg:-  ${oa.XXViewObject1.ViewAttrName}

If you are working with a table-in-table or HGrid that uses view links, you need to modify your SPEL syntax as shown: ${oa.current.viewAttrName}. The inclusion of current keyword lets you say "get the value from whatever row BC4J is using to render the current row" since you won't know how to access the view objects and row sets created dynamically for these complex components.

To add a VOAttribute value in a link 
eg: OA.jsp?OAFunc=XXX_FUNC&VENDOR_SITE_ID={@VendorSiteId}&SUPP_NAME={@SupplierName}

You can also use SPEL based on the security grant. The below expression will return false if <FunctionName> is granted to the current user/responsibility, otherwise true
   ${oa.FunctionSecurity.<FunctionName>}

If you want to pass a attribute for the form submission and if you want to encrypt the parameter, you can add the expression as below in the parameters property window:
   ${oa.encrypt.<ViewInstanceName>.<ViewAttributeName>} 

From 12.2, there is more support: OAF: EL (Expression Language)

Feel free to point out if anything is missing/wrong in this blog.

No comments:

Post a Comment