Hi Guys, In this post I'll share some interview questions and answers which i have faced or asked in interview panel.You can read my Part 1 QA by using url PART 1 QA and ADF PART QA 2.
3). What is <f:facet> ?
Ans). 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.
5). How to make any field mandatory?
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.
8). How
to Use the pageFlowScope Scope Within Java Code
Cheers Guys :)
1). What are the ADF templates, jspx pages, jsff page &
declarative components?
Ans). 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 <f:facet> 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.
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 <f:facet> 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.
2). What is region in Oracle ADF?
Ans). 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
<af:region> 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: <af:region value="#{mybean.myRegionModel}"/>
3). What is <f:facet> ?
Ans). 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.
4). How to skip validation in ADF?
Ans). Add
This method mainly used for view layer validation skip.
Ans). 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.
5). How to make any field mandatory?
Ans). Add attribute
required="true"
to that specific
field.
6). What is setActionListener?
Ans). 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 |
<af:setActionListener from="#{row.salary}" |
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.
7). How to pass Values Between Pages?
Ans). 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 the pageFlowScope
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:<af:commandButton text="#{pageFlowScope.buttonBean.label}"
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 commandButton
component, 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
8). How
to Use the pageFlowScope Scope Within Java Code
Ans). 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
For example, to retrieve an object from 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
For example, you might use the following Java code to clear the scope:
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();
9). How to pass ''af:selectOneChoice'' value to other page?
Ans). Add
valuePassThru="true"
attribute to select list.
10). What are types of ADF Faces components?
Ans). ADF Faces components:
Data components
Input components
Layout components
Navigational components
Output components
11). Why 'timeZone' attribute is required when <af:convertDateTime is used?
Ans). When <af:convertDateTime is used it takes by default GMT
time, for Indian timing we need to take GMT+5.30
EX.
<af:inputText
id="compId3882"
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);">
<af:convertDateTime
timeZone="GMT+5:30" pattern="dd/MM/yyyy"/>
</af:inputText>
12). What is
the difference between trinidad.config and trinidad.skins?
Ans). 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.
13). What is
the difference between an action and an action listener?
Ans). 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 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.
13). What
is a view scope?
Ans). 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.
14).What is
the difference between visible property and render property
Ans).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.
Ans).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.
15). How do
you define pagination in adf?
Ans). 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.
Ans). 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.
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,
16). What
are validators and converters?
Ans). 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.
Ans). 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.
17). What is
the difference between setting an immediate=true on a button and immediate=true
on a text field?
Ans). 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.
18). What is inter-portlet communication?
Ans). 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.
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.
18). What is inter-portlet communication?
Ans). 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.
19). What is PPR and how
do you enable Partial Page Rendering(PPR)?
Ans). 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.
Ans). 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.
20). Explain Iterator RangeSize Attribute
Ans). 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
<iterator Binds="CustomerInfoVO" RangeSize="25" DataControl="StoreServiceAMDataControl" id="CustomerInfoVO1Iterator"
ChangeEventPolicy="ppr"/>
By default, the rangeSize attribute is set to 25.
You can set it to -1 to have the full record set returned.
Ans). 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
<iterator Binds="CustomerInfoVO" RangeSize="25" DataControl="StoreServiceAMDataControl" id="CustomerInfoVO1Iterator"
ChangeEventPolicy="ppr"/>
By default, the rangeSize attribute is set to 25.
You can set it to -1 to have the full record set returned.
Cheers Guys :)
No comments:
Post a Comment