As my first post, I'd like to share the most common and basic and awesome feature in ADF framework.
A colleague of mine asked me today about passing parameters that would be, of course, a common use case in any application no matter how small or big the app is. This got me thinking, that while the answer can be straightforward, there really are different ways to pass parameters in an ADF application - depending on the requirements.
Probably, the simplest way to pass parameters is by using the component af:setPropertyListener.
<af:setPropertyListener from="#{bindings.StringItemToSend.inputValue}" to="#{pageFlowScope.SubmittedStringValue}" type="action"/>
If you notice, I am using here an unbounded taskflow, which will not give me access in setting up inputParameters. I purposely made this taskflow to show that even though I am not defining my pageFlowScope parameters in the taskflow, I can still always put a new parameter in the taskFlow Map object. But of course, it is better to define all parameters being utilized especially in the case of parameters being passed. Taskflows also acts as a visual diagram of the activities in a process.
Let's start making it interesting by passing the parameters into a taskFlow. In fact, let's make it even more interesting by having two taskFlow communicate using inputParameters and returnValues.
In this example, I will be creating two bounded taskFlows and fragments which will have similar properties:
- OutputText - Message from sender
- Bounded to inputParameter (pageFlowScope)
- InputText - Message to send
- Bounded to the returnValue (pageFlowScope)
- Button - Action to send and Navigate
bounded-flow-area-a |
bounded-flow-area-b |
I also made a third bounded taskFlow which will consume both these taskFlow and also handle the passing of their values. I used a requestScope to pass the parameters between the taskFlow so that I maintain it with the smallest scope possible.
The idea here is:
- From taskFlowA I pass a value to taskFlowB
- taskFlowB recieves the message and replies to taskFlowA
- taskFlowA also recieves the message again.
bounded-flow-area-container |
Properties of bounded-area-flow-b (which is exactly what A will have as well since only one of them will be sending the requestScope value during one navigation) |
That's it for this one.
On my next blog, I'll use parameter passing between more complicated taskflow use.