View Names
If you define an XML view using an XML string, no file is required.
If, on the other hand, you define an XML view in a file, which is more common, the file name ends with .view.xml
. For example, in the figure, Simple XML View, the file name is App.view.xml
.
Typically, views are stored in the view
folder of the project structure. The file name together with the location of the file in the project structure and the module Id prefix determine the name of the view. This view name corresponds to the SAPUI5 module name, via which the view can later be loaded and instantiated (see below).
Example
Suppose in the index.html
file of the project, the following attribute is specified in the bootstrap script:
data-sap-ui-resourceroots='{"sap.training.exc": "./"}'
Copy codeThis registers the webapp
folder of the project as a resource location, which is assigned to the module Id prefix sap.training.exc
. If the App.view.xml
file shown in the figure is now stored in the webapp/view
folder of the project, this results in the following view name:
The prefix sap.training.exc
of this view name refers to the webapp
folder. The view
segment following sap.training.exc
specifies the view
subfolder as the location of the file, and the last segment in the view name represents the file name, whereby the suffix .view.xml
is automatically added later when the view is loaded by SAPUI5.