Reputation: 41
While writing the javatodolist application for Play, I get an error from part "The application template"
reference to Form is ambiguous; it is imported twice in the same scope by import play.data._ and import play.api.data._
My index.scala.html
is at http://nopaste.info/f10c386a02.html
Upvotes: 4
Views: 1321
Reputation: 26
After having read the comments appended to the question, I got it working by qualifying the version of Form the view needs (the one from play.data) as in the following example:
@(myForm: play.data.Form[form.MyFormClass])
I guess that this behaviour is due to the fact that I am developing a Play application in java while the views are using the Scala API.
Upvotes: 0
Reputation: 30320
Play Framework offers a Java and Scala API. Clearly, you want the Scala API, but it looks like you've added both to your classpath and imported both.
Here is the Java version of Form
in the play.data
package.
Here is the Scala version of Form
in the play.data.api
package.
Get rid of the Java stuff, and you should be fine.
Upvotes: 0
Reputation: 405
The exception that you printed
reference to Form is ambiguous; it is imported twice in the same scope by import play.data._ and import play.api.data._
means that there are two classes with name Form one under package play.data._ , the other one under the package play.api.data._ I would recommend that you explicitly do your imports that means import just classes you would use.
Upvotes: 1