How to display the data in the Line Graph using ADF Faces Line Graph Component

1) Select the Line Graph component from the ADF Data Visualizations Core Pallette
2) Drag it on the jspx page
3) Add the binding for the tabulardata instead of the default binding variable.

<dvt:lineGraph id=”lineGraph1″ subType=”LINE_VERT_ABS”
emptyText=”No Data To Display”
tabularData =”#{backingBeanScope.backing_sample.getLineGraphTabularData}”
contentDelivery=”immediate” >
<dvt:background>
<dvt:specialEffects/>
</dvt:background>
<dvt:graphPlotArea/>
<dvt:seriesSet>
<dvt:series/>
</dvt:seriesSet>
<dvt:o1Axis/>
<dvt:y1Axis/>
<dvt:legendArea automaticPlacement=”AP_NEVER”/>
</dvt:lineGraph>
</af:form>
</af:document>
</f:view>


How to pass value on the click of af:commandLink in ADF Faces using

<af:commandLink text=”#{TestBundle.CUST_LOC_NAME}” id=”we7″
action=”#{pageFlowScope.testBean.executeTestMethod}”
binding=”#{pageFlowScope.testBean.setBeanValueVar}”
disabled=”#{pageFlowScope.varCheckValue==null || pageFlowScope.varCheckValue==’true’}”>
<af:setActionListener from=”true”
to=”#{pageFlowScope.varTemp1}”/>
<af:setActionListener from=”false”
to=”#{pageFlowScope.varTemp2}”/>
<af:setActionListener from=”false”
to=”#{pageFlowScope.varTemp3}”/>
</af:commandLink>


How to set the label or output text value retrieve from the property file field value in JSF Page

1) Define the Property Bundle file in the ViewController Project.
2) In the Page, add the below given line to load the property bundle file
<f:loadBundle basename=”com.test.bundle.TestPropeertyBundle” var=”TestBundle”/>
3) Define the output text on the Page
<af:outputText value=”#{TestBundle.CUST_LOC_NAME}” id=”ot1″ />


define mutiple selection content delivery rangeSize value in ADF Faces af:table component

Drag and drop method from the availabled Data Control tab in source tab to create ADF Read-only Table and make the below given changes

1) single row selection in af:table : For the Single Row selection , rowSelection=”single” should be defined

<af:table value=”#{bindings.OrderStatusVO1.collectionModel}”
var=”row” rows=”#{bindings.OrderStatusVO1.rangeSize}”
emptyText=”#{bindings.OrderStatusVO1.viewable ? ‘No data to display.’ : ‘Access Denied.’}”
fetchSize=”#{bindings.OrderStatusVO1.rangeSize}”
rowBandingInterval=”0″ id=”t2″
rowSelection=”single”
selectedRowKeys=”#{bindings.OrderStatusVO1.collectionModel.selectedRow}”
selectionListener=”#{bindings.OrderStatusVO1.collectionModel.makeCurrent}”>
2) mutiple row selection in af:table : For the multiple row selection, rowSelection=”multiple” and remove the property selectedRowKeys from the table to make multiple row selection
work .

<af:table value=”#{bindings.OrderStatusVO1.collectionModel}”
var=”row” rows=”#{bindings.OrderStatusVO1.rangeSize}”
emptyText=”#{bindings.OrderStatusVO1.viewable ? ‘No data to display.’ : ‘Access Denied.’}”
fetchSize=”#{bindings.OrderStatusVO1.rangeSize}”
rowBandingInterval=”0″ id=”t2″
rowSelection=”multiple”
selectionListener=”#{bindings.OrderStatusVO1.collectionModel.makeCurrent}”>

3)change the rangeSize value : To make the change in the rangeSize value, either set the value for rangeSize instead of the expression value in the property rows
or make the change in the View Object where RangeSize is defined


Oracle ADF property file field value retrieval from the backing bean

The blog provides the steps for retrieving the property field value from the backing bean class.

1) Select the path for the properties file created in the View Controller Project

2) Open faces-config.xml placed in the WEB-INF folder of your application
3) Select Overview tab
4) Select the Application option
5) Select the path for properties file created in the ViewController Project Message Bundle field.
6) Open the Backing Bean file where value to be retrieved from the properties file

String customerLocationName = JSFUtils.getStringFromBundle(“CUST_LOC_NAME”);


Oracle ADF configurations in web.xml

The Web Application using ADF Faces can have the below configurations in the web.xml
1. Context parameter javax.faces.STATE_SAVING_METHOD. Default value set to client
2. Filters and maping values related to trinidad components
3. Resouce Servlet and maping values related to trinidad components
4. Servlet and maping values related to JSF
5. ADF Authentication servlet and mapping values
6. mime-mapping values for images , css, pdf, applications and javascripts.

 

org.apache.myfaces.trinidad.webapp.TrinidadFilter defined in the filer-class of Trinidad ensures that the ADF Faces are initialized properly. It also processes the file uploads.

org.apache.myfaces.trinidad.webapp.ResourceServlet defined in the servlet-class of resources ensures that the web application resources (images, style sheets, JavaScript libraries) will be delegated to a resource loader

javax.faces.webapp.FacesServlet defined in the servlet-class of Faces Servlet handles the request processing lifecycycle for the web applications.
Context Parameters:

The context parameter – org.apache.myfaces.trinidad.CLIENT_STATE_METHOD is defined to specify the type of client-side state saving to use.
We can define the below given values:

– token: defined to identify the block of a state stored in the HttpSession object, will actually resides on the client.

– all: defined to store all the information in the hidden FORM field and do not use HttpSession.
The context parameter – org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS is defined to specify how many tokens should be stored at any one
time per user when token-based client-side state saving is enabled.

The context parameter – org.apache.myfaces.trinidad.COMPRESS_VIEW_STATE is defined to specify if the global state saving is to be compressed or not.

The context parameter – org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE is defined to enable the Application View Cache
to improve the performance by caching the state of the UI Pages
The context parameter – oracle.adf.view.rich.security.FRAME_BUSTING is useful when we need to show the content of the page in the IFRAME.

 

ADF Session Timeout:

The below configuration allows you to set the session time out value. This can be set from the Overview tab of the web.xml file also.
<session-config>
<session-timeout>40</session-timeout>
</session-config>
ADF Authentication:
You can add the authentication mechanism to be used for authenticating the user credentials by various ways. The below configurations
are required to add the authentication to the ADF Web Application.

<filter-mapping>
<filter-name>adfBindings</filter-name>
<servlet-name>adfAuthentication</servlet-name>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>

<servlet>
<servlet-name>adfAuthentication</servlet-name>
<servlet-class>oracle.adf.share.security.authentication.AuthenticationServlet</servlet-class>
<init-param>
<param-name>success_url</param-name>
<param-value>/faces/success.jspx</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>adfAuthentication</servlet-name>
<url-pattern>/adfAuthentication</url-pattern>
</servlet-mapping>

<security-constraint>
<web-resource-collection>
<web-resource-name>allPages</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>valid-users</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>adfAuthentication</web-resource-name>
<url-pattern>/adfAuthentication</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>valid-users</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>   // Authentication Type
</login-config>
<security-role>
<role-name>valid-users</role-name>
</security-role>


Oracle ADF Framebusting in Web Application

Oracle ADF provides the oracle.adf.view.rich.security.FRAME_BUSTING context parameter to implement the Framebusting in the web application.

When a malicious site tries to retrieve the content of a page from another domain into a frame and allows hyperlinks or buttons (partial content of the original page) and performs action, it is known as clickjacking. Framebusting helps the web application to prevent from clickjacking

If you want to consume your ADF application in a frame, set the below given configuration in the web.xml of the web application.

<context-param>
<param-name>oracle.adf.view.rich.security.FRAME_BUSTING</param-name>
<param-value>never</param-value>
</context-param>

The apache server might require the commenting of the X-Frame-Options: sameorigin. The current apache server will show the below settings

HTTP/1.1 200 OK

Server: Apache

Cache-Control: no-cache

Pragma: no-cache

X-Powered-By: JSF/1.2

X-Frame-Options: sameorigin

Content-Type: text/html;charset=UTF-8

Transfer-Encoding: chunked

Connection: Keep-Alive


Oracle ADF redirection to login page on session expiry exception by invoking the web Filter in web.xml

Make the following entries in the web.xml in the <filter> tag

<filter>

<filter-name>SessionExpiryFilter</filter-name>

<filter-class> com.test.session. InvokeSessionExpiryFilter </filter-class>

<init-param>

<param-name>RedirectWhenSessionTimeout</param-name>

<param-value>login.jspx</param-value>

</init-param>

</filter>

Create a new java class – InvokeSessionExpiryFilter

package com.test.session;

import java.io.IOException;

import javax.faces.context.ExternalContext;

import javax.faces.context.FacesContext;

import javax.servlet.Filter;

import javax.servlet.FilterChain;

import javax.servlet.FilterConfig;

import javax.servlet.ServletException;

import javax.servlet.ServletRequest;

import javax.servlet.ServletResponse;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

public class InvokeSessionExpiryFilter implements Filter {

private FilterConfig _filterConfig = null;

public void init(FilterConfig filterConfig) throws ServletException {

_filterConfig = filterConfig;

}

public void destroy() {

_filterConfig = null;

}

public void doFilter(ServletRequest request, ServletResponse response,

FilterChain chain) throws IOException,

ServletException {

boolean bypass = true;

String URL = ((HttpServletRequest)request).getRequestURL().toString();

HttpServletRequest httpRequest = null;

HttpSession session = null;

try {

httpRequest = (HttpServletRequest)request;

session = httpRequest.getSession();

if (session.getAttribute(“loginName”) == null) {

session.invalidate();

bypass = false;

} else {

bypass = true;

}

}

} catch (NullPointerException e) {

// RESET THE BYPASS FLAG TO FALSE IF LOGIN NAME IS NULL

bypass = false  ;

//  e.printStackTrace();

}catch (Exception e) {

// RESET THE BYPASS FLAG TO FALSE IF LOGIN NAME IS NULL

//  e.printStackTrace();

bypass = false  ;

}


Clustered Environment mapping in Oracle ADF

In the Web logic Server Clustered Environment for ADF, add the corresponding mapping in the ADF application so that the application can be accessed in case of any server failure. Following entries in the adf-config.xml and Weblogic.xml will be required to be updated.

Weblogic-application.xml: The file will be placed in the Application Resource tab -> META_INF folder. Open the XML file and add the below given tag in the file before the end tag </weblogic-application>

<session-descriptor>

<persistent-store-type>replicated_if_clustered</persistent-store-type>

</session-descriptor>

adf-config.xml: The file will be placed in the Application Resource tab -> ADF META-INF folder. Open the XML file and add the below given tag in the file before the end tag </adf-config>

<adf-controller-config xmlns=”http://xmlns.oracle.com/adf/controller/config”>

<adf-scope-ha-support>true</adf-scope-ha-support>

</adf-controller-config>