eclipse - Play 2 : "reference to form is ambiguous" error message in template

标签 eclipse scala playframework-2.0

我正在尝试按照书中的代码示例构建一个 play2 应用程序:
我在创建具有以下定义的表单模板时遇到了困难:
@(productForm: 表单[产品])

@main("Product Form") {
<h1>Product Form</h1>
@helper.form(action = routes.Products.save()) {
    <fieldset>
    <legend> Product (@productForm("name").valueOr("new"))</legend>
    @helper.inputText(productForm("wan"), '_label -> "EAN")
    @helper.inputText(productForm("name"), 'label -> "Name")
    @helper.textarea(productForm("description"), '_label -> "Description")
    </fieldset>
    <input type"submit" class="btn btn-primary" value="Save">
    <a a class=btn" href="@routes.Products.list()"> Cancel </a>
    }
 }

我得到以下 eclipse(我安装了 scala ide 插件)
Multiple annotations found at this line:
    - reference to Form is ambiguous; it is imported twice in the same scope by import play.data._ and 
 import play.api.data._

我应该忽略这条消息吗? play compile运行良好,但我没有从表单中得到任何输出。

最佳答案

为了纠正我必须插入的 eclipse 错误

 @(productForm: play.data.Form[Product])

代替:
 @(productForm: Form[Product])

关于eclipse - Play 2 : "reference to form is ambiguous" error message in template,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21120290/

相关文章:

playframework-2.0 - 如何激活javascript缩小?

spring - 无法让 WebApp 在 Eclipse 的 Tomcat 上初始化 [以前工作]

eclipse - 为什么在 Eclipse/PyDev 编辑器中打字变得很慢?

java - 使用单选按钮设置窗口背景

java - Play Framework 1.x 中模型 ID 的随机 8 位值

Scala Play 在表单中上传文件

c - 几个 Eclipse C/C++ 问题

arrays - Scala 数组属于哪个类别?

scala - 将JsDefined转换为字符串

Scala 发布路线图