服务器响应状态为404(无法找到资源!)SAPUI5

时间:2016-12-06 08:58:43

标签: sapui5

所以我刚刚使用Eclipse和SAP UI5创建了一个项目。

这是我的Index.html

<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

        <script src="resources/sap-ui-core.js"
                id="sap-ui-bootstrap"
                data-sap-ui-libs="sap.m"
                data-sap-ui-theme="sap_bluecrystal"
                data-ui-resourceroots='{"sap.myApp":"./"}'>
        </script>
        <!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

        <script type="text/javascript">

        sap.ui.getCore().attachInit(function()
                {
            sap.ui.xmlview({
                viewName: "sap.myApp.view.App"
            }).placeAt("content");
                });
        </script>

    </head>
    <body class="sapUiBody" role="application">
        <div id="content"></div>
    </body>
</html>

这是我的控制器名为App.Controller.js

     sap.ui.controller("sap.myApp.controller.App", {



});

视图命名为App.view.xml

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
    controllerName="sap.myApp.controller.App" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Title">
    <content>
<Image src="http://www.w3schools.com/css/img_fjords.jpg"/>
    </content>
</Page>

现在,当我尝试运行它时,我收到此错误。

sap-ui-core.js:126 GET http://localhost:55694/HelloWorld/resources/sap/myApp/view/App.view.xml 404 (Resource could not be found!)send @ sap-ui-core.js:126ajax @ sap-ui-core.js:126q.sap.loadResource @ sap-ui-core.js:174f.initViewSettings @ library-preload.js:907c._initCompositeSupport @ library-preload.js:862(anonymous function) @ sap-ui-core.js:461constructor @ sap-ui-core.js:461constructor @ sap-ui-core.js:971constructor @ sap-ui-core.js:805f @ sap-ui-core.js:638f @ sap-ui-core.js:638sap.ui.view @ library-preload.js:881sap.ui.xmlview @ library-preload.js:891o.(anonymous function) @ sap-ui-core.js:393(anonymous function) @ index.html:19(anonymous function) @ sap-ui-core.js:861each @ sap-ui-core.js:115w._executeInitListeners @ sap-ui-core.js:861w.init @ sap-ui-core.js:856w.handleLoad @ sap-ui-core.js:862(anonymous function) @ sap-ui-core.js:838l @ sap-ui-core.js:172S.finishTask @ sap-ui-core.js:172(anonymous function) @ sap-ui-core.js:838p @ sap-ui-core.js:126fireWith @ sap-ui-core.js:126ready @ sap-ui-core.js:126V @ sap-ui-core.js:126
sap-ui-core.js:174 Uncaught Error: resource sap/myApp/view/App.view.xml could not be loaded from resources/sap/myApp/view/App.view.xml. Check for 'file not found' or parse errors. Reason: Resource could not be found!(…)

任何人都可以告诉我,我做错了什么?

感谢。

2 个答案:

答案 0 :(得分:3)

正确的属性名称为data-sap-ui-resourceroots。但是,您的应用程序还有另一个问题。除非您正在开发SAPUI5 / OpenUI5内容,否则不得使用命名空间sap。请查看documentation

答案 1 :(得分:0)

sap.myApp命名空间的目录映射无效。 Mapping属性名为category

data-sap-ui-resourceroots