I have an object profileModel in my profile package and my profile.scala.html file have following code

@(model: ProfileModel)

when I compiles, it is giving an error recursive value model needs type

But when I moved this class to models with my application.conf as

ebean.default="models.*" 

it works. My guess is scala compiler automatically adds models.* to class path at the time of compilation

Is there a way to make this work without moving the class back to models package ?

I am using play 2.2.1 built with Scala 2.10.2

有帮助吗?

解决方案

If I understand you right, if your ProfileModel exists in profile package correct declaration in the view should be:

@(myProfile: profile.ProfileModel)

And 'yes', Play imports automatically all models and controllers (and also other well known types), but if you want to use any type in custom package (or ie. imported lib) you need to use full qualified path to it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top