In the last step, you used a template wizard to create a structure with context model elements for the component controller and bound this structure to generated model classes.
The component controller represents a central point in Web Dynpro, from which you can control the functions of a Web Dynpro component. In this way, its context serves as a storage area for all the data received from the model. However, a component controller cannot be directly linked with a view. For this reason, model data from the context of the component controller must be able to be passed to the context of a view controller. Only then can model data be displayed in a view.
It would be technically possible for a view context to access the model, but this would not be good design style. To use the MVC paradigm in a consistent manner, you also require the component controller as link between the view and the model.
In this step of the tutorial, you will map the context of the view controller onto the context structure of a component controller. Using this context mapping, you enable context elements of the view to be referenced – that is, elements that have data stored in the component context and themselves represent a copy of the actual model data.
Open the Data Modeler for the Web Dynpro component CarRentalComp.
1. In the toolbar, choose Create a data link.
2. Draw a line, beginning with the FormView view and ending at the Component Controller. The Model Binding Wizard starts automatically.
3. Using Drag & Drop, drag the node of the model class SaveBooking in the Component Controller to the root node of the view controller context.
4. In the following input dialog, select all the model nodes and model attributes. Then choose OK.
In the final dialog box, the context mapping declared between the two model nodes SaveBooking is displayed graphically:
5. Close the Model Binding Wizard by choosing Finish.
You have created the necessary view context and mapped it to the component context you created previously. The Data Modeler shows this through corresponding arrow links.
You are now in a position to bind UI elements such as input fields to the corresponding view context elements.