!--a11y-->
Creating a Component Context and Binding It to
the Model 
Each Web Dynpro component is supplied with a corresponding Component Controller. This controller is responsible for the acquisition of the data required by the QuickCarRentalService Web service for the car reservation. Accordingly, it must be able to depict the corresponding input and output structures of the CarRental model. In order to create a connection between the Component Controller and the model created in the previous step, you will bind the context of the Component Controller to the created model structure using the Data Modeler.
The following figure explains how the structure of the context tree generally results from the model classes and their relations to one another – on the basis of the model binding.

|
|
The structure of your project TutWD_CarRental_Init is currently displayed in the Web Dynpro Explorer. |
...
1.
Open the
Data Modeler through the context menu entry
Open Data Modeler of the node
CarRentalComp.
2.
In the toolbar on
the left, choose the
Add an existing model to the component
icon.
The icon will turn gray.
3.
Place the cursor on
the
Used Models area and
left-click.
4. Select the CarRentalModel checkbox and confirm by pressing OK.
The structure of the Web Dynpro component CarRentalComp will look like this in the Data Modeler:

In the Data Modeler, you can easily declare the connection between the context of the Component Controller and the CarRentalModel you have created.
1.
In the Data
Modeler toolbar, choose the
Create a data link icon.
2. Draw a line beginning at Component Controller and ending at CarRentalModel. The Model Binding Wizard starts automatically.
3. Using Drag & Drop, drag the node of the model class Request_QuickCarRentalServiceViDocument_saveBooking in the CarRentalModel to the root node of the component controller context, and drop it.

4. In the following input dialog, select all the model nodes and model attributes.

In general, it is appropriate to keep the similarity of names between the model classes and parameters and the corresponding context nodes or context attributes. However, the root node for the model is derived directly from the model main class Request_QuickCarRentalServiceViDocument_saveBooking with the same name: . In this case, it is better to take a shorter name, such as SaveBooking.
5. For this purpose, edit the new name SaveBooking in the first line under the table column Name, and then press Enter.

If you now expand the context tree in the following dialog boxes, the declared model link between the Component Context node and the model classes, including their relations, will be displayed graphically through link lines. The relations are expanded in the model tree (right window) in the associated classes.

6. Close the Model Binding Wizard by choosing Finish.
From the model definition, you have now defined a structure of context model elements (consisting of model nodes and model attributes) in the component controller CarRentalComponent, and you have also bound these to the corresponding model classes.
Map Component Context onto View Contorller
