Skip to Content
-1

Sample UI5 code from openSAP

Hi experts,

I copied some sample code from openSAP course about UI5, but it does not work. Could you help me find out what's went wrong?

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
		<meta charset="UTF-8">
		<title>OpenSAP - Developing Web Apps with SAPUI5</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='{"opensap.myapp" : "./" }'
		>
>
		</script>
		<script src="https://sap.github.io/openSAP-ui5-course/Validator.js"></script>
		<script>
			sap.ui.getCore().attachInit(function () {
				sap.ui.xmlview({
					viewName : "opensap.myapp.view.App"
				}).placeAt("content");
			});	
		</script>
	</head>
	<body class="sapUiBody" id="content">
	</body>
</html>


<mvc:View
	displayBlock="true"
	xmlns:mvc="sap.ui.core.mvc"
	xmlns="sap.m">
	<Carousel>
		<pages>
			<Image src="https://media.licdn.com/media-proxy/ext?w=800&h=800&hash=XDaJXBPZ7fCyfFVGLoVwsYbmef4%3D∨a=1%2CaFBCTXdkRmpGL2lvQUFBPQ%2CxAVta5g-0R6nlh8Tw1It6a2FowGz60oISIfYC2G8G2f1spyfNT-tdoDScbKhsgUbcS4FhlI_IfnwEXO5H-HJWNGROp0SytatTO-lUhMfbxZhqnhcuds8Plx3kdKpF-qtMWsc8e1-TwyJC73iVV8vLQll8fq4GKH6GWxUi3WUbO71GJVgTOdU6ZdW23dXv8HsDJM_0aJ67XFwkVW024jDHjwp06H_KXeVV0YcLkDGIvoUjr-G8RmZwwPgq2_2iJW-JviGQrEf2277z9TvJzTainFGk3EG9FI4iZhcC33-pv0YxE-CHckBfkuC4fbHGWuLoA" height="400px"/>
			<Image src="https://media.licdn.com/media-proxy/ext?w=800&h=800&hash=XDaJXBPZ7fCyfFVGLoVwsYbmef4%3D∨a=1%2CaFBCTXdkRmpGL2lvQUFBPQ%2CxAVta5g-0R6nlh8Tw1It6a2FowGz60oISIfYC2G8G2f1spyfNT-tdoDScbKhsgUbcS4FhlI_IfnwEXO5H-HJWNGROp0SytatTO-lUhMfbxZhqnhcuds8Plx3kdKpF-qtMWsc8e1-TwyJC73iVV8vLQll8fq4GKH6GWxUi3WUbO71GJVgTOdU6ZdW23dXv8HsDJM_0aJ67XFwkVW024jDHjwp06H_KXeVV0YcLkDGIvoUjr-G8RmZwwPgq2_2iJW-JviGQrEf2277z9TvJzTainFGk3EG9FI4iZhcC33-pv0YxE-CHckBfkuC4fbHGWuLoA" height="400px"/>
		</pages>
	</Carousel>
</mvc:View>

It did not display the picture as expected.

Thank you!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Feb 26, 2019 at 04:14 PM

    The problem is because the original image link is invalid, so I changed to another very long image link online, which is also invalid somehow.

    I changed the image src to some other image url, then it worked.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 26, 2019 at 12:56 AM

    another screenshot about your project folder structure.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 26, 2019 at 04:05 AM

    your xml is not well formed.


    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Jun,

      This is my project folder structure.

      I think the problem is from the <Image> tag, because if I comment the <Image> and changed it to <Button>, it works.

      <mvc:View
      	displayBlock="true"
      	xmlns:mvc="sap.ui.core.mvc"
      	xmlns="sap.m">
      	<Carousel>
      		<pages>
      			<!--<Image src="https://media.licdn.com/media-proxy/ext?w=800&h=800&hash=XDaJXBPZ7fCyfFVGLoVwsYbmef4%3D∨a=1%2CaFBCTXdkRmpGL2lvQUFBPQ%2CxAVta5g-0R6nlh8Tw1It6a2FowGz60oISIfYC2G8G2f1spyfNT-tdoDScbKhsgUbcS4FhlI_IfnwEXO5H-HJWNGROp0SytatTO-lUhMfbxZhqnhcuds8Plx3kdKpF-qtMWsc8e1-TwyJC73iVV8vLQll8fq4GKH6GWxUi3WUbO71GJVgTOdU6ZdW23dXv8HsDJM_0aJ67XFwkVW024jDHjwp06H_KXeVV0YcLkDGIvoUjr-G8RmZwwPgq2_2iJW-JviGQrEf2277z9TvJzTainFGk3EG9FI4iZhcC33-pv0YxE-CHckBfkuC4fbHGWuLoA"-->
      			<!--	height="600px" tooltip="globe"></Image>-->
      			<Button
      				text="Steady..."
      				press=".onPress"
      				type="Emphasized"
      				class="sapUiSmallMargin"/>
      		</pages>
      		<pages>
      			<!--<Image src="https://media.licdn.com/media-proxy/ext?w=800&h=800&hash=XDaJXBPZ7fCyfFVGLoVwsYbmef4%3D∨a=1%2CaFBCTXdkRmpGL2lvQUFBPQ%2CxAVta5g-0R6nlh8Tw1It6a2FowGz60oISIfYC2G8G2f1spyfNT-tdoDScbKhsgUbcS4FhlI_IfnwEXO5H-HJWNGROp0SytatTO-lUhMfbxZhqnhcuds8Plx3kdKpF-qtMWsc8e1-TwyJC73iVV8vLQll8fq4GKH6GWxUi3WUbO71GJVgTOdU6ZdW23dXv8HsDJM_0aJ67XFwkVW024jDHjwp06H_KXeVV0YcLkDGIvoUjr-G8RmZwwPgq2_2iJW-JviGQrEf2277z9TvJzTainFGk3EG9FI4iZhcC33-pv0YxE-CHckBfkuC4fbHGWuLoA"-->
      			<!--	height="600px" tooltip="globe"></Image>-->
      			<Button
      				text="Steady..."
      				press=".onPress"
      				type="Emphasized"
      				class="sapUiSmallMargin"/>
      		</pages>
      	</Carousel>
      </mvc:View>
      

      The error is like this:

      Thank you!

      structure.png (14.5 kB)
      imageerror.png (70.2 kB)

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.