Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Format. Show all posts
Showing posts with label Format. Show all posts

Tuesday 6 May 2014

ADF Basics : Selecting and showing time-stamp in ADF Faces using af:inputDate & af:convertDateTime

Hello All
This post is about a very common & basic requirement of developers ,
how to show & select time with date in ADF Faces ?
We use af:inputDate to show and select Date & Timestamp type of attributes, by default it looks like this

ADF provides a default converter (af:convertDateTime) to format date & timestamp field, we can define a pattern to change it's format & to show time selector in calendar box

Suppose pattern is- dd-MMM-yyy HH:mm:ss , now see there is a hour/minute/second selector appears in calendar box

you can change this pattern as per your format , suppose you want to show AM or PM after time just use dd-MMM-yyy HH:mm:ss a

see xml source of af:inputDate-

<af:inputDate label="Label 1" id="id1" contentStyle="width:250px;padding:5px;">
                        <af:convertDateTime pattern="dd-MMM-yyy HH:mm:ss a"/>

this is how we can change format of Date & Timestamp - Cheers :-)

Friday 5 July 2013

Changing af:convertNumber Format according to Locale- Oracle ADF

Simple post with very simple application-
we can covert a Numeric field format according to standard locale in ADF Faces.
when we have a numeric field on page there is a converter inside it, called af:convertNumber is extension of the standard JSF javax.faces.convert.NumberConverter.

 user can change it for Integer digits , fraction digits etc. but here i am talking about format of Number(Amount), to do this follow these steps.
  • Change GroupingUsed to true, by default it is true
  • Now set Locale, you can do this using managed bean or simply write it here
  • Managed Bean code to create Locale-  private Locale format=Locale.ENGLISH;
  • Now see various formats of Amount using Locale-

Using en-US-
 Using fr-
 Using hi-IN-for Hindi fonts
 Using de-DE -

so this is the thing how you can change formatting , this can also be done by managed bean.

  • Create a variable of type Locale and its getter -setter
  • Use it in Locale field of af:convertNumber  

  •     public void chinaButton(ActionEvent actionEvent) {
        public void frenchButton(ActionEvent actionEvent) {
        public void italianButton(ActionEvent actionEvent) {

  • You can also set Max and Min fraction digits in af:convertNumber