Monday, July 29, 2013

Debugging ADF Code

Debugging tends to be harder when various technologies and components are tightly coupled as changes in one may have impact in another.JDeveloper has several tools  that can be used to help debug an application . It contains procedures with breakpoints using ADF Declarative debugger .

Download the sample application ADF Debugging application

Jdev Studio Edition Version 11.1.2.4.0

1) Download , unzip the application and open the workspace from jdev.

2) Run the Main.jspx in debug mode. Right click on Main.jspx(view controller project) and select Debug.

3) The page opens up after sometime . Enter the value for the four input fields as 1,Allen,52,123456 and click Submit. As soon as you clicked the submit button ,the jdev window pops up and the console window shows where the breakpoint is created . According to our code we have set a breakpoint at Line:40 in the SourceFile1.java .

Setting a break point is very easy. Just Follow the below step




























4) Click on the icon as described in the above picture. (to go next breakpoint). It takes you to next break point in the code flow.

5)Next breakpoint in our code is at TF2 in TF1.xml . you can see the step by step debugging execution in the left side ADF Structure panel .Look at the above picture for reference.

6) Click on the icon (to go next breakpoint) . Now in the ADF Structure you can see the execution at TF2/fragement2 .Select  TF2 in the ADF Structure panel and click ADF Data panel . Expand pageFlowScope tree and you can see the passed input from the input screen to the target . Now again select /TF2/fragement2 from ADF Structure panel and click at next breakpoint.

7) Go to browser and you can see the output which was entered in previous page.

In this way you can set break points in various levels and can easily track your errors and missing values .

Friday, July 26, 2013

ADF : How to get input values in Managed bean

                 
Use case :

When I click a button, I want the button to call a method in a java bean and access the value of an input text fields  from ADF Faces pages .

There are many solutions available . This one is basic and easy approach

Solution : 

you can do this by creating binding for each component in a managed/backing bean so that bean will have getter/setter property created for you . Add a button in the page that will have the action listener method to the same bean where you have created bindings for the input components and you can access the values using this.getId().getValue() .




Jdev : Studio Edition Version 11.1.2.4.0
Download the sample application from here