Implementing the Event Handler of the View


To trigger a call of the Web service from the view, you only need to implement the respective event handler onActionRentCar()in the view controller. This event handler is always called when the RentCar action is triggered through a pushbutton. This step can be accomplished easily using the action button template.


You have created the model based on the CarRental Web service.

You have mapped the view context onto the Component Controller context.




       1.      Start the layout editor for the FormView.

       2.      In the Outline, select the button with the label Rent. Then open the context menu.

       3.      From the context menu, choose Apply Template.

This starts the template wizard.

       4.      Confirm your selection through ActionButton and choose Next.

       5.      In the following dialog, define the button properties. Enter Rent a Car as Button Label. Otherwise, you can adopt the proposed values for Action and Event. Choose Next.

       6.      In the next dialog step, create the properties for the Eventhandler. For this purpose, activate the Call Method checkbox and choose the CarRentComp entry for the controller. The required method is then executeSaveBooking.

       7.      Close the wizard with Finish.

       8.      Save the contents of the Editor.


The Developer Studio updates and compiles the Java classes belonging to your project. (Note: Compilation only occurs if you are using the Workbench standard settings.)


The implementation of the event handler in the view controller is reduced to a single line with which the method execute_SaveBooking() of the component controller is called. The returned results of the Web Service call (in the example application, solely the reservation ID number and the rental price) are then displayed automatically in the UI through data binding.


public void onActionRentaCar( wdEvent )


    //@@begin onActionRentCar(ServerEvent)

   //$$begin ActionButton(889060304)







Next Step:

Building, Deploying, and Running Your Application