<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta charset="UTF-8">
<title>SAPUI5 HelloWorld</title>
<script
id="sap-ui-bootstrap"
src='https://sapui5.hana.ondemand.com/resources/sap-ui-core.js'
data-sap-ui-theme="sap_belize"
data-sap-ui-libs="sap.m"
data-sap-ui-resourceroots='{
"saphanatutorial": "./"
}'>
</script>
<script>
sap.ui.getCore().attachInit(function () {
var oView = sap.ui.view({
viewName: "saphanatutorial.view.HelloWorld",
type:sap.ui.core.mvc.ViewType.JS,
});
oView.placeAt("content");
});
</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
sap.ui.jsview("saphanatutorial.view.HelloWorld", {
getControllerName: function() {
return "saphanatutorial.controller.HelloWorld";
},
createContent: function(oController) {
var oButton = new sap.m.Button({text:"Say Hello with JavaScript View"});
oButton.attachPress(oController.onPress);
return oButton;
}
});
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("saphanatutorial.controller.HelloWorld", {
onPress: function(Event) {
alert("Hello! Button clicked in JavaScript View");
}
});
});