Skip to main content

Adding the Controller

Next, we add the controller, in this case a dataController component, to ZenTutorial.HomePage.cls. We use the modelClass attribute to associate the controller with the model, in this case ZenTutorial.ContactModel.

Place the following XML element anyplace in between the ZenTutorial.HomePage.cls <page></page> tags.

<dataController id="contactData"  
    modelClass="ZenTutorial.ContactModel" 
    modelId=""
/>

Note that the dataController component passes the value of the modelId attribute to the model's %OnOpenSource method. It represents the object ID of the database object that the model opens. Initially, we set the value of the modelId attribute to the empty string (""). Our application dynamically sets the value of this attribute to valid object ID values.

FeedbackOpens in a new tab