SAPUI5本地安装

时间:2013-10-25 18:25:46

标签: sapui5

我正在尝试使用XAMPP在本地计算机上安装SAPUI5。 我将文件复制到htdocs。 在Chrome中启动localhost我获得了SAPUI5 SDK - 演示工具包概述页面。

之后我将“HowTo in 20 seconds”代码的示例代码复制到记事本并将其保存为HTML-Document。

在浏览器中运行此文件只会显示白页。

我在Chrome中查找了开发人员工具,看到了类似这样的内容:

“未能预加载'sap.ui.core.library-preload':未找到 - sap.ui.ModuleSystem”

我希望你能帮我解决这个问题,所以我可以从SAPUI5开始

6 个答案:

答案 0 :(得分:2)

打开一个新的记事本文件。使用html扩展名保存以下代码,例如:helloworld.html

<!DOCTYPE html>
<html>
<head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge" />

  <title>SAPUI5 in 20 Seconds</title>

  <!- 1.) Load SAPUI5, select theme and control library ->
  <script id="sap-ui-bootstrap"
          type="text/javascript"
          src="https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js"
          data-sap-ui-theme="sap_goldreflection"
          data-sap-ui-libs="sap.ui.commons"></script>

  <!- 2.) Create a UI5 button and place it onto the page ->
  <script>

    // create the button instance
    var myButton = new sap.ui.commons.Button("btn");

    // set properties, e.g. the text
    myButton.setText("Hello World!");

    // attach an action to the button's "press" event (use jQuery to fade out the button)
    myButton.attachPress(function() { $("#btn").fadeOut(); });

    // place the button into the HTML element defined below
    myButton.placeAt("uiArea");

    // an alternative, more jQuery-like notation for the same is:
    /*
    $(document).ready(function() {
      $("#uiArea").sapui("Button", "btn", {
        text:"Hello World!",
        press: function(){ $("#btn").fadeOut(); }
      });
    });
    */

  </script>
</head>
<body class="sapUiBody">

  <!- This is where you place the UI5 button ->
  <div id="uiArea"></div>

</body>
</html>

现在使用任何现代浏览器打开文件。仅供参考,我们不需要任何服务器来测试这个

答案 1 :(得分:1)

有关此主题的有用链接,我可以推荐:

他们都使用Github的 UI5 SplitApp Boilerplate ,这是一个示例应用程序,具有基本应用程序结构:https://github.com/6of5/UI5SplitApp-Boilerplate

也许这有助于您开始本地发展

答案 2 :(得分:1)

您可以将Eclipse配置为使用SAPUI5,并在本地环境中工作时使用Apache Tomcat来运行您的应用程序。

  1. 安装Eclipse - http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunasr2
  2. 安装Java Runtime Enviromnet - http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
  3. 安装Apache Tomcat - http://tomcat.apache.org/download-80.cgi
  4. 在Eclipse中安装SAPUI5工具

    • Eclipse&gt;帮助&gt;安装新软件
    • 使用网址在“可用软件网站”中添加新网站:https://tools.hana.ondemand.com/luna
    • 在使用选择中选择新网站。
    • 展开HTML5的UI开发工具包&amp;选择用于HTML5的UI开发工具包(开发人员版)
    • 下一步&amp;安装(可能需要重启Eclipse)
    • 现在您已安装SAPUI5工具。如果您创建了一个新项目,现在可以获得SAPUI5应用程序开发选项。

    在服务器中配置Apache Tomcat

    • 添加服务器,窗口&gt;偏好&gt;服务器&gt;运行时环境&gt;添加
    • 选择Apache Tomcat 8.0(或您使用的任何版本)&amp;选择Next。
    • 选择Tomcat安装目录&amp;完成。

    现在你已经准备好了。创建一个新的SAPUI5项目(比如myProject),添加一些代码。要在tomcat上运行它,请右键单击Project,Run As&gt;在服务器上运行。选择您的Tomcat服务器,Next&amp;完。你的项目将是up&amp;在http://localhost:8080/myProject/

    的服务器上运行

答案 3 :(得分:0)

  

“未能预装”的混乱不应该是致命的错误;库预加载文件是可选的捆绑优化,以减少HTTP请求的数量。

https://github.com/SAP/openui5/issues/119

我认为你可以忽略这个警告。加载Cross origin requests时遇到Component.js问题,使用python -m SimpleHTTPServer解决了这个问题。你需要的只是一台服务器,选择你喜欢的任何东西。

答案 4 :(得分:0)

丹尼尔·我建议您SAPUI Walkthrough作为起点。这是关于如何构建SAPUI5应用程序的分步指南/教程,包含有关基石和最佳实践的说明。
对于基础知识,您只需要一个编辑器和一个浏览器(没有网络服务器)。
This git repo包含所有演练步骤作为单独的分支。

答案 5 :(得分:-1)

SAP UI5只是用于开发前端的一堆UI库,就像其他库一样,如jQuery。现在,问题是如何配置Apache来提供这些文件?这是用于提供文件的基本Apache配置,this page可能是一个很好的起点。