I will describe how you can work with view criteria items in easy way. Often when you will use Oracle search component - af:query, you may face requirement to access entered criteria items and perform one or another action based on the result. I would like to recommend always base view criteria items on Bind Variables, this will greatly help you while working with query pages.
Download developed sample application - QueryCriteriaParams.zip. In this sample I'm accessing entered criteria item values and based on this show or hiding result components.
As I already have mentioned, I have declared view criteria based on Bind Variables:
In View layer I have overridden Query Listener (more: ADF Query Component and View Criteria Functionality with Custom Query Listener in 11g):
I'm accessing view criteria items directly in overridden Query Listener. I can do this by getting Bind Variable values from VO Variable Manager. Here is a power of defining View Criteria on Bind Variables, not just Literals. Sample code where I'm accessing criteria values and showing/hiding result components on the page:
On runtime, when page from my sample application is rendered, user will see just View Criteria available:
According to implemented logic, if user will enter First Name criteria and will do search, table component with results data will be present:
If user will enter both criteria parameters - Firs Name and Last Name, this means instead of table, form component will be rendered: