Thursday, June 16, 2011

How to pass multiple parameters to a Bean method from JSF

Having used to java operations, we sometimes find the realm of EL Expression a little short of easy utilities in sending parameters directly from JSF.

This example, while it might not be a standard solution, can provide some easy wins in some situation.

Anyway, here's the code solution.

First thing we need to do is make our own Dummy map which basically implements all of the Map interfaces less the Map.get(Object)


So from this Map, we will try to achieve this :)



So, let's start with the Single Parameter input (I'm just going to show codes from here on since it's pretty straightforward):


And here's its Multiple Parameter counterpart. As you can notice, the more parameters you are handling, the more complicated it can possibly be.

Thursday, June 2, 2011

How to close a TaskFlow Popup Launched Using an af:Popup

Been awhile since I've posted something, so I decided to make a quick and easy hint in ADF.

TaskFlows can be launched as a Popup in a couple of ways in ADF. The most common, I think, is through a taskflow control-case with the following settings:



Then there is the obvious, region in a popup where we drop a fragment taskflow directly inside a popup. I'll show the two common case using a direct popup and a dialog.



The limitation of using it as a direct region though is that the close button is outside the controls of the taskflow, basically, the taskflow itself does not call the close unlike the use of an inline popup as described in the first example. So what happens if we just call the taskflow return from the taskflow? As described in F. Nimphius Fusion Dev Guide, the taskflow itself will close thus closing the binding itself. Here's an example.

Before

After
And forevermore it will remain close unfortunately. Now, to get around this we're going to have the taskflow itself handle situations where it will close the popup without calling the return. To do this, we'll basically retrieve the parent'most component until it is a RichPopup and just call the popup.hide() from there on. So lets go back to coding.

For the fragment, we'll have the return button but this time, it will call an actionListener instead of the controlcase for the return.




Presto. Hope that helps.