Tuesday, November 8, 2011

af:switcher and af:goLink Example ADF 11g

Hi,

Here is an example demonstrating how to conditionally have a goLink on your jspx.
The case is simple, based on some value, the goLink should not be a goLink and be an output text.
In other words, how to implement a conditional goLink.
af:switcher  comes into the game. With af:switcher we can have facets. Each facet has a name. The switcher will determine which facet will be rendered or not. So, all we have to do is to write the appropriate condition. Check the Following screen:

As you can see in the above screen, the facetName property of the switcher can accept EL and infact what we did here, to conditionally render a facet of the switcher. The translation of the facetName is the following:

#{aVariableHere eq 'aVale' ? 'GOLINK' : 'OUTPUTTEXT'}


means:

"if the  aVariableHere  equals to  aValue  then (?) render the facet with name GOLINK else (:) render the facet with name OUTPUTTEXT.

In this example, the values are strictly illustrative, they should change depending on bussiness logic.

Regards.

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...