Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我正在寻找一些使用Play框架将Polymer与服务器端Scala/java结合使用的帮助_Java_Scala_Playframework_Polymer - Fatal编程技术网

我正在寻找一些使用Play框架将Polymer与服务器端Scala/java结合使用的帮助

我正在寻找一些使用Play框架将Polymer与服务器端Scala/java结合使用的帮助,java,scala,playframework,polymer,Java,Scala,Playframework,Polymer,我正在用Play框架在scala项目中尝试聚合物。我在一开始就跟踪了。在我的index.scala.html中,我包含了my-element.html并试图访问我的元素。我没有像预期的那样在元素中看到我的内容。任何关于我尝试做的事情是否可行的建议。先谢谢你 在Mac上,在IntelliJ中创建了一个play java应用程序 已从安装最新的play framework 2.3.7 解压缩zip文件并运行activator命令activator new以创建新项目 打开Intellij IDEA并

我正在用Play框架在scala项目中尝试聚合物。我在一开始就跟踪了。在我的index.scala.html中,我包含了my-element.html并试图访问我的元素。我没有像预期的那样在元素中看到我的内容。任何关于我尝试做的事情是否可行的建议。先谢谢你

在Mac上,在IntelliJ中创建了一个play java应用程序

  • 已从安装最新的play framework 2.3.7
  • 解压缩zip文件并运行activator命令activator new以创建新项目
  • 打开Intellij IDEA并导入新项目
  • 通过激活器运行项目
  • 代码附在下面

    octo元素。html:

    <link rel="import" href="../bower_components/polymer/polymer.html">
    <polymer-element name="octo-element" noscript>
        <template>
           <span>Hello from <b>octo-element</b>. This is my Shadow DOM.</span>
    </template>
    </polymer-element>
    

    聚合物组件(html和java脚本)应在资产下创建。资产路由是在路由配置中定义的。

    包括一些详细信息和示例代码会有所帮助。请看:首先,请记住,它与Play没有太多关系,而是与html和JavaScript有太多关系。您是否检查了所有资源是否正确导入?现代浏览器的控制台告诉你这一点。i、 使用Chrome时按下f12,您将看到。我想它会抛出一些错误,如果是这样,我会告诉您将资源移动到public/assets,并像hello.js文件一样导入它们。嗨,谢谢您的建议。成功了。错误在源文件中。但这一建议确实有所帮助。
    @(message: String)
    @main("Welcome to Play") {
    
    @message
    <octo-element></octo-element>
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <title>@title</title>
        <link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
        <link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
        <script src="@routes.Assets.at("javascripts/hello.js")" type="text/javascript"></script>
            <!-- 1. Load platform support before any code that touches the DOM. -->
        <script src="../../bower_components/webcomponentsjs/webcomponents.min.js"></script>
            <!-- 2. Load the component using an HTML Import -->
        <link rel="import" href="../../bower_components/elements/octo-element.html">
    </head>
    <body>
        @content
    </body>
    </html>
    
    package controllers;
    
    import play.mvc.Controller;
    import play.mvc.Result;
    import views.html.index;
    
    public class Application extends Controller {
    
    public static Result index() {
        return ok(index.render("Your new application is ready."));
    }
    
    }