Log in functionality in ADF application

Requirement: Log in to ADF application and navigate to Admin / Customer pages based on type of user logs in.

This can be done in many ways. Here i’m giving one way of achieving the requirement.

1) First create a jspx page and don’t forget to select ‘Automatically Expose UI Components in a new Managed Bean’ while creating the page. Now a java class is also created automatically which holds the bindings of the page which we created earlier.

2) Now drag and drop the Input Text (ADF Faces.Common Components) two times for username and password fields. And also Drag and drop a Button (ADF Faces.Common Components) for Log in button.

login1

3) Now create the task flows from current log in page to Admin and Customer pages in faces-config.xml file by giving proper path names to the flows.

taskflows

-> // Logic is get the user entered input username value and compare with the required value and Navigate to the respective pages by calling respective task flow with path name (action name) //

4) Now bind the username input field value to a String in backing bean java class and set the autoSubmit property to true

<af:inputText label=”Username” autoSubmit=”true” value=”#{backingBeanScope.backing_oracle_webcenter_portalapp_pages_test.username}”
                            binding=”#{backingBeanScope.backing_oracle_webcenter_portalapp_pages_test.it1}”
                            id=”it1″/>

5) Create a String with name as username and generate accessors for it.

6)for  Calling  a java method after clicking on button give action as

action = “{backingBeanScope.backing_oracle_webcenter_portalapp_pages_test.validateLogin”

create the method validateLogin in the bean and write the logic in that method.

login_java

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s