Requirement – to understand the concept of page variable for storing temporary page value.
Use Case- We have a check box and a table.on checking of checkbox we should show table otherwise we should not show the table.
Normally most of ADF developer will say– oh , its easy, they bind checkbox with managed bean and select the value of it and make visible true and false to table. But , in actual it impacts performance.You really don’t need a managed bean,Why you need to interact with model layer.You don’t need it.
You can create a page variable and store temporary page value.Most people don’t know about it or don’t know how to create it.Today we will discuss this.
i am assuming you have a HR schema and create a table and a checkbox.On checking of checkbox table should be visible.
Go to page definition file of page.Inside executable ,select variable and click insert inside variable like below
Now we will be creating binding for this variable.Click + on binding
Select attributValue and select variable as data source and attribute as Show Table, which we have created earlier.
Now our page defition file will look like this-
Select checkbox and bind value as #{bindings.ShowTable1.inputValue} and make autosubmit to true.
Go to table and put id of selectCheckbox to partial trigger of table.
Thats it .You have’nt used managed bean here. I think its more easy than this.Now run your page first it will look like this
Now Checked the checkbox
You are done.Now you know how to create page defition variable in page.Managed bean will not have less code.. š
Happy coding with Vinay Kumar in Techartifact ….