Friday, September 13, 2013

ADF Interview Questions-1

Q: What are the ADF templates, jspx pages, jsff page & declarative components?
A: ADF Faces provides the following types of reusable building blocks
Page fragments(.jsff): Page fragments allow you to create parts of a page. A JSF page can be made up of one or more page fragments. For example, a large JSF page can be broken up into several smaller page fragments for easier maintenance.
We can create an page fragments template & use to create page fragments.

Page templates (.jspx): By creating page templates, you can create entire page layouts using individual components and page fragments. For example, if you are repeatedly laying out some components in a specific way in multiple JSF pages, consider creating a page template for those pages. When you use the page template to build your pages, you can be sure that the pages are always consistent in structure and layout across the application.
Using default layouts or creating new we can create page templates.
Ex. Using we can create page templates with header, footer, top, left & right regions etc. 

Declarative components: The declarative components feature allows you to assemble existing, individual UI components into one composite, reusable component, which you then declaratively use in one or more pages.
For example, if you are always inserting a group of components in multiple places, consider creating a composite declarative component that comprises the individual components, and then reusing that declarative component in multiple places throughout the application.
Declarative components can also be used in page templates.
Declarative components can also be used in other applications, its possible after creating JAR file of that component.

Q: What is region in Oracle ADF?
A: Tag name : af:region
The region tag allows dynamic content to be included in a master page. This tag is bound to a RegionModel. The model decides which viewId is to be included. The model has methods that allow pre and post processing of an include. See the javadoc for oracle.adf.view.rich.model.RegionModel.

This component does not support any facets.
Regions support nesting (one af:region component can contain another af:region component).
Regions are not allowed to be placed inside of af:forEach, c:forEach, or other forEach-like tags because of limitations in how JSF handles component IDs and component state which would manifest in your application in obscure manners such as loss of component state.
Regions are also not allowed to be placed inside of af:iterator because the region requires bindings to be established at the tag execution phase in order to perform its JSP include operations and the variables for iterators are not established until later in the life-cycle.

Regions in release 11g are reusable page flows. They have their own navigation rules, managed beans and ADFm page definitions. Each page within the region is a page fragment (jsff). Do not confuse the 11g af:region component with the 10.1.3 or Trinidad region. The 10.1.3 and Trinidad region components are single page fragments that do not have multiple pages, navigation rules nor managed beans. The 10.1.3 region is similar to the 11g page templates and declarative components.

The will not stretch all included children, but it will stretch an included child if all of the following are true:
The region itself does not have a header
The region itself is being stretched
There is only a single included child
The child must be capable of being stretched
Example:

Q: What is f:facet name = "" ?
A: This tag is used to add a facet to the component means this tag is used to add its child as a facet of the closest parent component.
With the help of this tag we can add header and footer facet to the container component like panelGroup.

This tag contains one attribute :
name : This is the required attribute and is used to set the name of the facet. "header" and "footer" values can be used for this attribute.

Q : How to skip validation in ADF?
A : Add immediate="true" to the button. This way all input fields which don't have immediate="true"will be skipped in processing.
This method mainly used for view layer validation skip.

Q : How to make any field mandatory?
A : Add attribute required="true" to that specific field.

Q: What is setActionListener?
Ans:While af:setActionListener is fully supported, the best practice is to use af:setPropertyListener type="action".
SetActionListener – The setActionListener tag is a declarative way to allow an action source ( , , etc.) to set a value before navigation. It is perhaps most useful in conjunction with the “processScope” EL scope provided by ADF Faces, as it makes 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.
Exmaple of this can be as follows. Suppose we have a table “employee”.We want to fetch the salary of an employee of some particular row and want to send this salary in Next page in process scope or request scope etc.So using this we can do this.

It have two attributes :

From – the source of the value; can be an EL expression or a constant value

To – the target for the value; must be an EL expression
1 2 to="#{processScope.salary1}"/>

This setActionListener will pick value of salary of that row and store this value into salary1 variable.So anyone can use this salary as processScope.salary1.
It is very simple to use and very useful.


Q: SetPropertyListener vs. SetActionListener
A: The af:setPropertyListener and af:SetActionListener components are located under the Operations section of the ADF Faces components panel in the Oracle JDeveloper Component Palette. They are used to write objects into memory or a managed bean property. While both listeners appear to have identical functionality, they are actually different. The af:SetActionListener responds to action events only, such as a button or link mouse click. In contrast, the af:setPropertyListener responds to events such as calendar, value change, disclosure, focus, launch, poll, range change, return, row disclosure, dialog, launch popup, popup fetch, query, query operation, region navigation, and return popup. The SetPropertyListener is new in Oracle JDeveloper 11g and should be used instead of the SetActionListener, which is included in Oracle
JDeveloper 11g for backward compatibility.

Q: How to pass Values Between Pages?
A: The ADF Faces pageFlowScope scope makes it easier to pass values from one page to another, thus enabling you to develop master-detail pages more easily. Values added to thepageFlowScope scope automatically continue to be available as the user navigates from one page to another, even if you use a redirect directive. But unlike session scope, these values are visible only in the current page flow or process. If the user opens a new window and starts navigating, that series of windows will have its own process. Values stored in each window remain independent.
Like objects stored in any standard JSF scope, objects stored in the pageFlow scope can be accessed through EL expressions. The only difference with the pageFlow scope is that the object names must use the pageFlowScope prefix. For example, to have a button's label provided by a managed bean stored in the pageFlow scope, and to have a method on the bean called when the button is selected, you might use the following code on your page:
                  action="#{pageFlowScope.buttonBean.action}"/>
The pageFlowScope is a java.util.Map object that may be accessed from Java code. The setPropertyListener tag allows you to set property values onto a scope, and also allows you to define the event the tag should listen for. For example, when you use the setPropertyListener tag with the type attribute set to action, it provides a declarative way to cause an action source (for example, commandButton) to set a value before navigation. You can use the pageFlowScope scope with the setPropertyListener tag to pass values from one page to another, without writing any Java code in a backing bean. For example, you might have one page that uses the setPropertyListener tag and a command component to set a value in the pageFlowScope scope, and another page whose text components use the pageFlowScope scope to retrieve their values.
You can also use the pageFlowScope scope to set values between secondary windows such as dialogs. When you launch secondary windows from, for example, a commandButtoncomponent, you can use a launchEvent event and the pageFlowScope scope to pass values into and out of the secondary windows without overriding values in the parent process.

Tip: Instead of using the setActionListener tag (which may have been used in previous versions of ADF Faces), use the setPropertyListener tag and set the event type to action.

Q: How to Use the pageFlowScope Scope Within Java Code

A: You can access pageFlow scope from within any Java code in your application. Remember to clear the scope once you are finished.


Note: If your application uses ADF Controller, then you do not have to manually clear the scope.

To use pageFlowScope in Java code:
To get a reference to the pageFlowScope scope, use the org.apache.myfaces.trinidad.context.RequestContext. getPageFlowScope() method.
For example, to retrieve an object from the pageFlowScope scope, you might use the following Java code:
import java.util.Map;
import org.apache.myfaces.trinidad.context.RequestContext;
. . .
Map pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
Object myObject = pageFlowScope.get("myObjectName");
To clear the pageFlowScope scope, access it and then manually clear it.
For example, you might use the following Java code to clear the scope:
RequestContext afContext = RequestContext.getCurrentInstance();
afContext.getPageFlowScope().clear();

Q. How to pass ''af:selectOneChoice'' value to other page?
A: Add valuePassThru="true" attribute to select list.

Q. What are types of ADF Faces components?
A: ADF Faces components:
Data components
Input components
Layout components
Navigational components
Output components

Q. Why 'timeZone' attribute is required when A: When EX.
                                            label="#{messageBean['SS_DATE_OF_BIRTH']}"
                                            disabled="true" maximumLength="50"
                                            value="#{bindings.DateofBirth.inputValue}"
                                            inlineStyle="font-size:smaller; font-weight:normal; font-  
                                            family:Arial;color:rgb(69,69,69);">
   


Q: What is the difference between trinidad.config and trinidad.skins?A: trinidad.config file is ceated when you create a webcenter portal application. This is used to register the skin-family you are going to use for your entire application. Trinidad.skins is used when we use skin as a Jar file. This file provides a mapping between the Skin Id and the actual path where the skin exists.

Q: What is the difference between an action and an action listener?
A: 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.
Action listener is a class that wants to be notified when a command component fires an action event.
Action returns String ActionListner returns void.
Action used for page navigation with faces-config.xml or adf-config.xml, ActionListner is used for event handling, to retrieve data & other operations, its used with backing beans or bindings.
Action use - for page navigation, ActionListner use - check box, drop down box.
Q: What is a view scope?
A: view-state allocates a new viewScope when it enters. This scope may be referenced within the view-state to assign variables that should live for the duration of the state. This scope is useful for manipulating objects over a series of requests from the same view.

Q: What is the difference between visible property and render property
A: 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.

Q: How do you define pagination in adf?
A: It was not possible to do pagination on af:table component before R1 release 11.1.1.7, although this feature was exist in 10g but not available in previous 11g series. (Ref blog - Click here..)

In 11g series there were some customization approach for pagination:
1. 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.
2. Using JavaScript
3. Customizing VO java code,

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

Q: What is the difference between setting an immediate=true on a button and immediate=true on a text field?A:  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.

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.

Q: What is inter-portlet communication?
A: 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.

Q. How to do table pagination in Oracle ADF?
A: This feature has brought back from 10g to new R1 release 11g-PS6 (10.1.1.7.0)
Go through blog: Click here..

Q: How To Control ADF Table Pagination on Runtime and Do Case Insensitive Search?
A: Go through blog: Click Here..

Q : What is PPR and how do you enable Partial Page Rendering(PPR)?
A : PPR is a feature supported by ADF Faces, using which we can render a small portion of a HTML Page, without refreshing the complete page.
It is enabled by.- Setting AutoSubmit property to true on the triggering element.
- Setting the PartialTriggers property of target component to refer to component id of the triggering element.

Q : Explain Iterator RangeSize Attribute
A : Iterator bindings have a rangeSize attribute that the binding uses to determine the number of data objects to make available for the page for each iteration. This attribute helps in situations when the number of objects in the data source is quite large. Instead of returning all objects, the iterator binding returns only a set number, which then become accessible to the other bindings. Once the iterator reaches the end of the range, it accesses the next set.
Example shows the default range size for the CustomerInfoVO iterator.
Example RangeSize Attribute for an Iterator
ChangeEventPolicy="ppr"/>

By default, the rangeSize attribute is set to 25.
You can set it to -1 to have the full record set returned.
Related Posts Plugin for WordPress, Blogger...