on 01-07-2023 11:35 AM
Hi All,
Below is my SAPUI5 project in BAS where I am facing some error. Below is the error -
The resource couldn't be loaded as the path couldn't be resolved. Below is my code snippet. Could anyone advise why the resource load isn't happening? What am I missing here?
I defined the attribute data-sap-ui-resourceroots='{"com.dc": "./"}'. It points to the root folder atleast that is what I hope. Also same namespace is defined and passed as a configuration object during the method call sap.ui.xmlview(). The property viewName is pointing to the namespace.<view folder>.App.
What is wrong here? Please advise.
index.html code snippet
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Week1 - getting Started</title>
<script id="sap-ui-bootstrap" src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m" data-sap-ui-compatVersion="edge"
data-sap-ui-preload="async" data-sap-ui-resourceroots='{"com.dc": "./"}'>
</script>
<script>
sap.ui.getCore().attachInit(() => {
/* let oImage = new sap.m.Image({
src: "https://picsum.photos/id/237/200/300"
}).placeAt("content");
});
*/
sap.ui.xmlview({
viewName: "com.dc.view.App"
}).placeAt("content");
});
</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
App.view.xml code snippet
<mvc:View displayBlock="true" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
<Carousel>
<pages>
<Image src="https://picsum.photos/id/237/200/300" height="400px" />
<Image src="https://picsum.photos/seed/picsum/200/300" height="400px" />
</pages>
</Carousel>
</mvc:View>
Below is the folder structure of the project
Regards,
Ravenclaw.
data-sap-ui-resourceroots='{"com.dc": "../"}' check if it makes any difference.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would suggest you should learn ui5 by following some standard sap tutorial, after you get some understanding of UI5 then come up with something of your own.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please check the folder structure as described:
https://sapui5.hana.ondemand.com/#/topic/003f755d46d34dd1bbce9ffe08c8d46a
Thanks Thorsten, the folder structure wasn't right. Thanks for pointing out the resource. I have put the view folder under the webapp folder. But I still see the same 404 response code and failed to load the resource. I beleive the XML view has the right syntax and there isn't any pasring error. Not sure why the failure is happening after the re-organization of the folders, Thanks.
Regards,
Ravenclaw.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.