In one of my current projects, I came across a wired problem concerning a task flow which uses parameters to configure the flow. To make it simple to understand the problem I made up a fictive use case.
This is not a real use case, but an abbreviation of it just to show the problem and how to resolve it. It might not make sense in real life, but it allows to show the problem.
We like to see a form to enter some data. One of the fields the user can enter should be used to select a specific layout of the following pages. Ony Layout should be horizontal and one should be vertical.
The layout should allow showing a title with a number, a text part, and a footer part. Each of the parts is optional, only the layout must be specified.
The flow can be used at different points in different flows in the application.
The implementation is easy. We build a task flow, build with pages, and add 5 parameters to it. This task flow looks like this:
In a router component, we check the required parameter to decide which layout to use. The ‘none’ page is used if the parameter is not ‘v’ or ‘h’.
For the layout pages, which implement the layout part, I used a af:panelGridLayout with the right number of rows and columns. Here is the vertical.jsf page
Or the source view
The other pages can be found in the sample which was built using JDeveloper 184.108.40.206. You can download the sample using the link at the end of the blog.
Now that we have the reusable task flow we need another task flow (adfc-config.xml in this case) to show how to use the use of the task flow.
We see an index page which calls the task flow using three different navigations (toPageNoParam, toPageAllParam and toPageTextOnly). The difference between the navigations are the parameters set to the task flows.
Here they are
Running the application we get the following output after filling in the form on the index page
WAIT, this doesn’t look right. The page with text only parameters displays the text in the footer section instead of the text section. If we look at the parameters defined for this task flow call we see
Yes, we added the value to the wrong parameter, ‘footer’ instead of ‘text’!
Easy change, we copy move it over to the ‘text’ parameter using copy and paste:
And we get
Great, this looks like it should be.
WAIT again, in the log window we now get an error message
<oracle.adf.model> <ValueMappingXmlImpl> <parse> <ADFc: /WEB-INF/adfc-config.xml: Failed to parse element input-parameter: null value found for value.>
If you look closely at the parameters, you’ll notice, that the ‘footer’ value is empty, whereas the other not set values showing a ‘-’. So we add the ‘-’ to the footer parameter:
To get this output running the app:
The error message in the log window is gone 🙂
Hm, but now we see the ‘-’ for the footer value. The value for the ‘title’ parameter looks identical to the parameter ‘footer’. However, we don’t see the ‘-’ for the ‘title’ in GUI.
Looking at the XML of the task flow call shows:
Now the problem is, that JDeveloper shows a ‘-’ for a parameter which is not set in the XML representation, meaning that the parameter is not in the XML structure at all!
The ‘-’ we typed into the ‘footer’ parameter is visible as value for the parameter and thus it printed when running the application.
The final solution is to remove the ‘footer’ parameter from the XML structure:
This will get us the following display in JDeveloper
The resulting running page now looks like
And we don’t see the error message in the log.
You can download the final application from GitHub BlogTaskFlowParameter. The sample was built using JDeveloper 220.127.116.11.0 and doesn’t need a DB connection.