문제

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