Sunday, July 31, 2011

How to Automatically Redirect to Different Page on session timeout in Oracle ADF

Share this Post

You might be aware of my previous Session Timeout Post in Oracle ADF.

By default if timeout happens ADF don't give you any warning message unless enable it (Post by Frank Nimphuis explained)  you send some request to server (like click on page) after timeout. Our requirement was to redirect the page to default home page automatically after 15 minutes of inactivity.

Note: We had Webcenter 11g PS2 Spaces application.

The solution we implemented is to write a JavaScript code on PagePhaseListener which integrate code on every page as similar to this blog post

Download the sample code

More details in this video

Happy JDeveloping,
Zeeshan Baig

How to execute Java code before and after Task flow

Share this Post

Its been a while i posted some video tutorials so finally i have recorded couple of videos which i will be posting regularly from now.

If you want to execute some logic when entering or exiting (or on exceptions) on bounded task flow (yes for only bounded task flows) you can call some manage bean method on Initializer and finalizer properties of the task flow.

Common use cases for these properties are as follows:


1. Validate some task flow inputs

2. default values setup


1. Releasing resources

2. Perform some cleanup of data

Download the sample code 

Watch this video on how to use these properties.

Happy Jdeveloping,
Zeeshan Baig

Getting HTTP session timeout max value in Java

Share this Post

If you want to know in Java the value of HTTP session timeout in ADF application. You can use the following code snippet.

        FacesContext facesCtx = FacesContext.getCurrentInstance();
        ExternalContext extCtx = facesCtx.getExternalContext();
        HttpSession session = (HttpSession)extCtx.getSession(false);
        int val = session.getMaxInactiveInterval();

Note that this value is coming from web.xml file you can see how to set this value by clicking here

Happy Jdeveloping,
Zeeshan Baig

Monday, July 11, 2011

Working with Domain Type in ADF Business Components

Share this Post


What are domains type in ADFBC?

The answers is “Whenever you are in a situation where you want to standardized the validations and checks on special type attributes  e.g.  email field must be complete email address or number must be odd or even etc etc. In that case you can create a domain of that type and link with the entity objects or view objects attributes”.

In simple words domains will save a lot amount of time in your development and helps you to make standards.

Note: You can create domains on Oracle object types as well

How to create domain types? 

This is a 3 step process which is as follows

1. Create a domain of some type e.g String, Number, Date

2. Override the validate() method in Domain’s java class. In case of fail validation your method must throw DataCreationException in the oracle.jbo package.

3. Choose the Attribute type as your new domain in entity or view object


1. Right Click on model and choose New Domain as shown in the slide



Choose the data type for domain


Under java tab of domain’s properties click on the class name appearing


Override the validate method as shown in the slide. Note that there is a string mData is declared automatically which is reference to the type of domain.


Link the Domain to your attribute in entity object in our case i use First Name note that our domain name is appearing in Type List


Right click application module and Choose run and enter more than 30 characters in First name and navigate outside you will see the similar error. it is the validation of domain that causing this…….


Feel free to add this domain to any String attributes you like.

Download the sample code

More info at

Happy Jdeveloping,

Zeeshan Baig

Thursday, July 7, 2011

Store format mask for ADF BC in Jdeveloper

Share this Post


If you have some format mask that you want to use on multiple occasions you can store them in formatinfo.xml file which resides at following location

C:\Documents and Settings\<Username>\Application Data\JDeveloper\system<jdev-version>\o.BC4J


Suppose we would like to display some dates in “July, 7 2011” format to use in different applications

We will follow the below steps to achieve this

  1. Open format.xml file
  2. Add the following entry under “DOMAIN CLASS="oracle.jbo.domain.Date" entry  <FORMAT text="MMM, dd yyyy"  />        
  3. Open Jdeveloper and entity object contains Date attribute
  4. Go to UI Hints tab, choose format type to Simple Date and you can see the newly added format mask is available in the list


This could safe some amount of time in big projects

Hope you like it happy Jdeveloping

Zeeshan Baig