【问题标题】:Migrate sapui5 application to openui5将 sapui5 应用程序迁移到 openui5
【发布时间】:2014-06-15 17:28:28
【问题描述】:

在 Eclipse 中开发的SplitApp 演示运行良好。 当我尝试将其迁移到 Openui5 时,我遇到了问题。

我已将引导 URL 更改为 https://openui5.hana.ondemand.com/resources/sap-ui-core.js

问题依然存在。

我得到如下错误:

2014-06-15 22:26:43 Device API logging initialized - DEVICE sap-ui-core.js:44
2014-06-15 22:26:43 registerResourcePath ('', 'https://openui5.hana.ondemand.com/resources/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 URL prefixes set to: -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43   (default) : https://openui5.hana.ondemand.com/resources/ -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 registerResourcePath ('view', './view/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 registerResourcePath ('model', './model/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 registerResourcePath ('app', './app/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:43 registerResourcePath ('i18n', './i18n/') -  sap.ui.ModuleSystem sap-ui-core.js:80
2014-06-15 22:26:44 registerResourcePath ('model', './model/') -  sap.ui.ModuleSystem sap-ui-core.js:80
GET http://myDomain/i18n/i18n_en_US.properties 404 (Not Found) sap-ui-core.js:27
GET http://myDomain/i18n/i18n_en.properties 404 (Not Found) sap-ui-core.js:27
GET http://myDomain/i18n/i18n.properties 404 (Not Found) sap-ui-core.js:27
GET http://myDomain/model/menu.json 404 (Not Found) sap-ui-core.js:27
2014-06-15 22:26:45 The following problem occurred: error - 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
  <head>

    <meta name="revisit-after" content="10">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <script type="text/javascript" language="JavaScript"
        src="http://cdn.dsultra.com/js/registrar.js"></script>

    <script type="text/javascript" language="JavaScript">
        registrar_frameset({ a_id: 48873,       // edit this to pass your portfolio ID,
                             drid: 'as-drid-2416478692338427'});     // edit this to pass your Domain Registrant ID
    </script>

  </head>
</html>,404,Not Found  sap-ui-core.js:80
GET http://myDomain/model/coffee.json 404 (Not Found) sap-ui-core.js:27
2014-06-15 22:26:45 The following problem occurred: error - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
  <head>

    <meta name="revisit-after" content="10">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <script type="text/javascript" language="JavaScript"
        src="http://cdn.dsultra.com/js/registrar.js"></script>

    <script type="text/javascript" language="JavaScript">
        registrar_frameset({ a_id: 48873,       // edit this to pass your portfolio ID,
                             drid: 'as-drid-2416478692338427'});     // edit this to pass your Domain Registrant ID
    </script>

  </head>
</html>,404,Not Found

错误说它无法找到 json 模型和属性文件。 如果我必须在应用程序级别维护配置,请告诉我。

请在 Github 中找到 openui5 源代码,所附图像包含 eclipse 中用于 sapui5 的文件夹结构。

【问题讨论】:

  • 也许您可以共享引导参数以及文件夹结构中的内容,以文件方式。那么我们或许可以为您提供更多帮助。
  • DJ,感谢您的宝贵时间。请在GITHUB 中找到 openui5 源代码。我是 StackOverflow 的新手,我不知道如何在 cmets 中附加图像。所以我已经回答了我自己的问题以附上文件夹结构的图像。
  • 在项目中提到的所有文件夹中,文件夹模型和 i18n 中的 json 和属性文件出现 404 错误。是否有任何特定的配置需要在应用程序级别进行维护,或者是否在域级别进行任何操作?请帮助我找到问题的解决方案。谢谢。

标签: sapui5


【解决方案1】:

您的 splitapp_demo/app/Component.js 需要进行如下更改:

jQuery.sap.declare("app.Component");
//jQuery.sap.require("app.MyRouter");

sap.ui.core.UIComponent.extend("app.Component", {
    metadata: {
        name: "DEmo App",
        version: "1.0",
        includes: [],
        dependencies: {
            libs: ["sap.m", "sap.ui.layout"], //add any other libraries you need
            components: []
        },

        //rootView : "app.view.App",

        config: {
            resourceBundle: "i18n/i18n.properties",
            //if you have service
            /*serviceConfig : {
                name: "SERVICE_NAME",
                serviceUrl: "/your/service/url/"
            }*/
        },

        routing: {

            routes: [
              //your routes
      ]
        }
    },

    init: function () {
        sap.ui.core.UIComponent.prototype.init.apply(this, arguments);

        var mConfig = this.getMetadata().getConfig();

        // Always use absolute paths relative to our own component
        // (relative paths will fail if running in the Fiori Launchpad)
        var oRootPath = jQuery.sap.getModulePath("app");

        // Set i18n model
        var i18nModel = new sap.ui.model.resource.ResourceModel({
            bundleUrl: [oRootPath, mConfig.resourceBundle].join("/")
        });
        this.setModel(i18nModel, "i18n");

        var sServiceUrl = mConfig.serviceConfig.serviceUrl;

        //This code is only needed for testing the application when there is no local proxy available
        var bIsMocked = jQuery.sap.getUriParameters().get("responderOn") === "true";
        // Start the mock server for the domain model
        if (bIsMocked) {
            this._startMockServer(sServiceUrl);
        }

        // Create and set domain model to the component
        var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, {
            json: true,
            loadMetadataAsync: true
        });

        // if you have static models
        //  var oModel = new sap.ui.model.odata.ODataModel([oRootPath, "model/coffee.json"].join("/"), {json: true,loadMetadataAsync: true});
        this.setModel(oModel);

        // Set device model if needed
        var oDeviceModel = new sap.ui.model.json.JSONModel({
            isTouch: sap.ui.Device.support.touch,
            isNoTouch: !sap.ui.Device.support.touch,
            isPhone: sap.ui.Device.system.phone,
            isNoPhone: !sap.ui.Device.system.phone,
            listMode: sap.ui.Device.system.phone ? "None" : "SingleSelectMaster",
            listItemType: sap.ui.Device.system.phone ? "Active" : "Inactive"
        });
        oDeviceModel.setDefaultBindingMode("OneWay");
        this.setModel(oDeviceModel, "device");

        //this.getRouter().initialize();

    }
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多