Monday, August 30, 2010

Uploading and Downloading Images in Oracle ADF

Share this Post
Hi,

In this post we will see how to upload and download images in Oracle ADF application.

Note: this example does not store images in BLOB column it just copy the image from client machine to server directory.

Download the sample workspace





Happy JDeveloping,
Zeeshan Baig

Monday, August 23, 2010

How to setup Custom Authentication in Oracle APEX

Share this Post
Hi,
Recently on ODTUG mailing list one fellow asked about using custom authentication schemes in APEX. i thought it would be good idea for my blog post :)

In this video i will demonstrate how to create login page which authenticates username and passwords from database tables in Oracle APEX.

Note: The purpose of this post is just to show the setting up custom authentication therefore i have used a very simple db table with passwords stored as text.
In real world this password approach in not recommended you must store passwords in encrypted columns or use any procedure to convert passwords into encrypted form.

Database structure

 create table my_users
(user_name varchar2(10),
 user_pwd varchar2(10));

insert into my_users
values('Tom','Secret');

insert into my_users
values('Baig','oracle');

commit;

Authentication Function

create or replace function 
validate_user_from_db (p_username in varchar2, p_password in varchar2)
return boolean
as
    v_pw_check varchar2(1);
begin
    select 'x'
    into v_pw_check
    from my_users
    where upper(user_name) = upper(p_username)
    and user_pwd = p_password;
    
    apex_util.set_authentication_result(0);
    return true;
exception when no_data_found then
    apex_util.set_authentication_result(4);
    return false;
end validate_user_from_db;


Authentication messages

0: Normal, successful authentication
1: Unknown User Name
2: Account Locked
3: Account Expired
4: Incorrect Password
5: Password First Use
6: Maximum Login Attempts Exceeded
7: Unknown Internal Error

A little code to test our authentication function( This function for only test in SQL prompt)

declare
 vresult varchar2(10);
begin 
 if validate_user_from_db ('baig','oracle') then 
    dbms_output.put_line('OK');
 else
     dbms_output.put_line('ERROR');
 end if;
end;


And finally a video tutorial steps



Happy learning,
Zeeshan Baig

Sunday, August 22, 2010

Using Page Templates in ADF Fusion application

Share this Post
Hi,
I will continue my last topic which is related to building resuable components in ADF. In this post i will demonstrate how to create and use page templates to provide common look and feel in ADF application.

More info in this video and download the sample workspace



Happy JDeveloping,
Zeeshan Baig

Saturday, August 14, 2010

Sharing Business Components and Task flows between ADF Application

Share this Post
Hi,

Lot of my friends those are coming the Oracle Forms background and new to ADF asks this question "How to share components of one application with another" well the answer is simple by using "ADF Library Jar" deployment profiles.

Explore more in this video



Happy JDeveloping,
ZB

Monday, August 9, 2010

Configuring APEX Listener with GlassFish Server

Share this Post
Hi,

Currently i am developing one application with APEX and today i configured APEX listener with Glassfish server in my development environment to evaluate Glassfish with Oracle HTTP server..so far i faced an issue with Interactive reports are not working properly with Glassfish.

APEX Listener currently not working with ORACLE XE (as far as i know, waiting for patch)

Here are the configuration steps





You can check the installation guide for more info

Have a nice day,
ZB

Saturday, August 7, 2010

How to get Client IP Address in ADF Fusion Application

Share this Post
Hi,

One of the most common requirement is to get the IP Address of the client. You can use the following methods in a session scope bean.


public String getClientIpAddress() {
        String clientIpAddress =
         ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRemoteAddr();
            return clientIpAddress;
    }


Happy JDeveloping,
ZB

Thursday, August 5, 2010

Using af:switcher component in Oracle ADF Faces

Share this Post
Hi,
     As i explained in my last video working with Router activity in Task flows the same functionality can be achieved using ADF Faces af:switcher component on JSF page. This example will also quickly shows how to use DVT components on JSF page.

Here is the example hope you like it




Download the example

Happy JDeveloping,
ZB