Wednesday, April 02, 2014

Binding variable in ADF-Hello World

We have already seen how to create a helloWorld sample in ADF using data control.

In this exercise we will try to create the same HelloWorld page using java alone and no data control.

Create a new Fusion Web Application.

Right click on your ViewController and create a new JSP page





Now design your layout as per your requirement and drag and drop an inputText in to your page.Change the label to reflect the name your like.



Now click on the binding as highlighted



click on new an create a new Managed Bean



Create a property variable for input



This will create a java program for you with the following input



Now drag and drop a button and rename it as per your requirement.



next drag and drop an outputtext in the page and also rename it as per requirement.



Next click on biding and create a property for output variable also ,Make sure to point it to the same Managed bean that we have created earlier for input text



Now we have binded our input and output variable what it exactly is mean is that now we can manipulate the java code to change the values of these parameter in the ADF page.

So we have the input and output parameter now we need a handle to get the input parameter, concat it with a string and assign to output variable.

these things should happen when we click on our button.

so just double click on the button that you have created in your ADF page

you will get an option to select the bean and create a method.

Select the bean that we have created and select the default method.



Say ok and now you should be able to see following code in your java class



We have to manipulate this code so that we can get the input, concat it and can assign to output.

Write the following code in the method

RichInputText inputText = getInputVal();
String name = "Hello "+(String)inputText.getValue();
System.out.println("Value Enterted is "+name);
outputValue.setValue(name);

This will first get the input from the getter method of input, will concat it with String "Hello " and then it will assign it to the output variable using the setter method of output variable.

Go ahead and deploy the code to integrate weblogic server.

you will get following output page



Pass an input parameter and click on execute




No comments: