Building a Simple Airport Weather Application using ADF

Introduction

This exercise demonstrates how to build an ADF JSP application which presents a databound dropdown list of airports where users can check the weather of the airports using an external Web Service.

The Struts Page flow will look like the following:

Getting Started

Travel Database

For this exercise you'll need to connect to the airport database which can be installed with this script: airport.sql

Once you've created the airport schema, make a connection in JDeveloper for this schema and name it " airport".rport

Airport Weather Web Service

Make a new Web Service connection to the Airport Web Service.

Initial Steps

Building a Databound HTML Select list

Now build a basic HTML select but with dynamic data from ADF. This is a doable by first building a standard HTML select control and then databinding it with dynamic ADF data using JSTL .Here's an easy way to do this...

Add a datacontrol for the Airport Web Service

Now create a Data Control for the Airport Web Service.

DataBind the DataAction getTempWS

In the page flow, drag and drop the getTemperature service in the Data Control Palette as a method onto the getTempWS dataAction. This will allow the DataAction to call the airport WebService when it executes. The next step is to grab the "code" parameter, and send it off to the Web Service. This is done by setting a parameter attribute of the Action.

Create your results page

In this step we'll create a results.jsp page which prints the temperature from the Web Service. The first thing we have to do is create a "success" forward from the getTempWS DataAction pointing to our results.jsp.

 

Now let's create the results page and databind it with our airport weather data.

At this point you should be done but before running the app, we can also add a link from this page back to the starting page.