Show TOC

JS ViewsLocate this document in the navigation structure

You create a JS (JavaScript) view in the same way as a controller and use the suffix .view.js. for the file. SAPUI5 provides the following two default methods for implementation:

  • getControllerName(): Specifies the controller belonging to this view

    If this method is not implemented or returns NULL, the view has no controller.

  • createContent(): Called initially once after the controller has been instantiated

    This method is used to create the UI. As the method knows the controller, it can directly attach the event handlers.

sap.ui.jsview("sap.hcm.Address", {  // this View file is called Address.view.js
   getControllerName: function() {
      return "sap.hcm.Address";     // the Controller lives in Address.controller.js

   createContent: function(oController) {
      var oButton = new sap.ui.commons.Button({text:"Hello JS View"});
      return oButton;


The string in quotes denotes the view name that equals the SAPUI5 module name within the require/declare concept.