Saturday 5 March 2016

ADF Interview Questions - Set 3

Question: What is the difference between visible property and render property?
Answer: The visible property is set to true/false based on the requirement whether we want to see the field on the page or not at run time. The field or component still exists on the page, though hidden. The render property is used to conditionally load the component based on a criteria.

Question: How do you define pagination in ADF?
Answer: We define custom pagination in ADF by creating a custom table as a taskflow using the af:iterator tag. This renders the collection of data just as a table renders it. Now we bind the value property of iterator to collection model from ADF bindings declaration and set the number of visible row to, say 15.

Question: What are validators and converters?
Answer: Validators and Convertors are used to provide conversion and validation capabilities to the ADF input components respectively.Converters convert the values on ADF forms to the type in which the application accepts them after the values are edited on the form and submitted. Validators are used to impose validations on the input components.

Question: What is the difference between setting an immediate=true on a button and immediate=true on a text field? 
Answer: When immediate is true on a button, the command’s action and ActionListeners, including the default ActionListener provided by the JavaServer Faces implementation, will be executed during Apply Request Values phase of the request processing lifecycle, rather than waiting until the Invoke Application phase. Life Cycle for Immediate="true" on command component is
        Restore View->Apply Request Values->Render Response 

In case of a text field, by default, values are converted and validated together in the Process Validators phase. However, if you need access to the value of a component during Apply Request Values – for example, if you need to get the value from an actionListener on an immediate commandButton – then setting this to "immediate" makes that possible. Life Cycle for Immediate="true" on input component is

 Restore View->Apply Request Values->Process Validations->Update Model->Invoke App->Render Response 

Question: What are the different types of bindings in ADF?
Answer: ADF contains the following types of bindings:
1. Attribute Bindings: This is the binding to retrieve the value of a single view attribute in the iterator binding’s current view row. For eg; #{bindings.CustomerId.InputValue}
2. Tree Bindings: This is used for tables, tree-tables and trees. It is used to expose rows of a table in the iterator binding’s current range. Eg; All Customers-#{bindings.AllCustomers.labels.CustomerId}.
3. Action Bindings: This binding type is used when buttons or command links are dropped on the user interface and require an action to be performed on them. We can use data control operations on them, for eg, Create, Delete, First, Last, Commit, Rollback etc.
4. Method Bindings: This binding is used when you want to use custom methods to be executed.
5. Iterator Binding: This binding is created by the application to access the ADF binding context. It contains a reference to the page bound data collection, helps access it and iterates over its data objects.

Question: What is the difference between an action and an action listener?
Answer: Actions are designed for business logic and participate in navigation handling, whereas Action listeners typically perform user interface logic and do not participate in navigation handling.

Basically the "action" attribute refers to an action method which returns a String from which the Faces navigation model can use to decide whether or not a navigation is necessary based on the value of the string.

An actionlistener method compared to an action method does not return a String. Instead it returns void. It is basically identical to the action method but instead it just executes the code after an action event (button click or link click) but a navigation is not needed. Action listener is a class that wants to be notified when a command component fires an action event. An action listener contains an action listener method that processes the action event object passed to it by the command component.

Question: What is setActionListener?

Answer: The setActionListener tag is a declarative way to allow an action source to set a value before navigation. It is perhaps most useful in conjunction with the “processScope” EL scope provided in ADF Faces, as it makes it possible to pass details from one page to another without writing any Java code. This tag can be used both with ADF Faces commands and JSF standard tags.

Question: What is the difference between JSP-EL and JSF-EL?
Answer: JSP-EL
In JSP-EL the value expressions are delimited by ${…}.
The ${…} delimiter denotes the immediate evaluation of the expressions, at the time that the application server processes the page.
JSF-EL
In JSf-EL the value expressions are delimited by #{…}.
The #{…} delimiter denotes deferred evaluation. With deferred evaluation ,the application server retains the expression and evaluates it whenever a value is needed.

Question: What are Contextual events?
Answer: Contextual event is a way to communicate between taskflows. Sometimes we have taskflow open in a region and have to get some values from that taskflow. This scenario can be achieved by contextual event.
Contextual Event have two parts-
Publisher Event (Producer)- As button or any component that can raise event 
Handler Event (Customer)- that listens and process event published by producer

Question: What is inter-portlet communication?
Answer: Inter-portlet communication is achieved when an action in one portlet triggers a response in the second portlet. Its a communication bridge between two portlets. For eg, one portlet contains a checkbox containing list of products. When I choose a product from the list and click on submit, the other portlet displays the details of the respective product.

Question: What is meta data commit during life cycle phase of ADF?

Answer: The metadata changes are written to the MDS repository after the JSF Invoke Application phase in JSF life cycle.

No comments:

Post a Comment