December 24, 2013

Localization with f: loadBundle

To implement localization in ADF applications, we create property files with the fields and their values in different languages. For example, I have below property file with some fields and their values in Danish language. I want to display these values in the jsf page to the user.
BODY               =Hoveddel
ITEM               =Varepost
SUBMIT           =Indsend
SUMMARY     =Oversigt
COPY            =Kopier

To use these property fields and to display on the jsf page, we were provided a tag called “loadBundle” whose syntax is as below.

<f:loadBundle basename="application" var="app"/>

Where “application” is the basename of the property file and “app” is the variable name to be used in the jsf page to invoke these fields of the property file. If you are using more property files for different language like French,English and Danish, then the property file names should be as follows.

application_fr.properties
application_en.properties
application_da.properties

And maken a child entry to the tag <application> for the used languages in the faces-config.xml as below

<locale-config>
      <default-locale>fr</default-locale>
      <supported-locale>en</supported-locale>
      <supported-locale>da</supported-locale>
    </locale-config>

So, whenever the language is changed, the corresponding property file will be picked up to display the fields.
And to use the fields in the page, we use el expression syntax like #{app.BODY}
In the loadBundle tag, for the basename attribute, we can also pass the ResourceBundle class instead of property file name.

September 25, 2013

Upload batch or bulk data into Oracle Cloud database

To upload bulk data into oracle cloud database service, which is presented in a text or excel file, follow the below procedure.

1)      Login to the oracle cloud and launch the database service
2)      Under “SQL Workshop”, select “Data work shop” option
3)      In the “Data Load” panel, select the option from which type of file you want to load the data
4)      Data loading wizard will be started
5)      Follow the wizard carefully and give the necessary inputs and click on finish

July 15, 2013

Status Indicator in ADF

In ADF, sometimes it will take time to load or refresh a page. In such cases, if you want to display some icon to indicate the page is loading or refreshing, you can use the ADF component “Status Indicator” which is available in Common Components panel. As ADF components are ajax components, the status indicator automatically identifies the status of the action and animates accordingly. The icon of status indicator on a page typically looks like as below.


July 12, 2013

java.lang.UnsupportedOperationException



As the name implies when the requested operation is not supported, we get this error.
Below is a sample program to generate this error.

public static void main(String args[])
{
String st[]={"Hi","Hello","Bye"};
List list=Arrays.asList(st);
list.add(“Anand”); //Get error at this line
System.out.println(" List: "+list);
}

 If we run this method, we get the below error because we are trying to add a new element to a list which is not updatable.

Caused by: java.lang.UnsupportedOperationException
                at java.util. List.add(List.java:131)
                at java.util. List.add(List.java:91)
                at Test.main(Test.java:7)

 I modified the program as below to run without errors.

public static void main(String args[])
{
String st[]={"Hi","Hello","Bye"};
ArrayList<String> list = new ArrayList<String>();
//List list=Arrays.asList(st);
list.addAll(Arrays.asList(st));
list.add(“Anand”); //Get error at this line
System.out.println(" List: "+list);
}


July 1, 2013

Making cloud application public


To make an ADF application to be accessible to all users, which is deployed in cloud environment, make an entry of the tag <login-config/> in web.xml

June 26, 2013

Error: Page template name already used in library


I have created a page template with name “PageTemplate.jspx” in JDeveloper for my application, but I deleted the file later. Again when I tried to create a page template with the same name “PageTemplate.jspx”  in the application then I got the below validation error “Page template name already used in library”.





Even if we delete the file from JDeveloper, entries from some configuration files may not be deleted. Hence, we get this error.
There are two solutions for this.
The simplest one is to give different name to the template :D .
Another one is,
  • Go to META-INF folder under Application Source of the project
  • Open the file “pagetemplate-metadata.xml”
  • You should find your pagetemplate entry with in the tags
     <pagetemplate-jsp-ui-def>…</pagetemplate-jsp-ui-def>
  • Remove the entry and save the xml file
  • Now you should be able to create the page template with the same name