我正在尝试按照书中的代码示例构建一个 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/