Domanda

I created a new project using the play console
now, by default I got in my views directory two files:

main.scala.html   
index.scala.html 

I want to add a new view file. I call it "forums.scala.html"
now, I know that in order to render a view you need to do this:

views.html.forums.render("Forums");

the problem is that the intellisense doesn't recognize "forums"
but index and main it does recognize.
I've noticed those files:

class_managed/views.html/index.class
class_managed/views.html/main.class

but there is no forums.class so I suspect this is the problem.
I tried to build the project, but it didn't help.
so, what is the solution?

thanks

È stato utile?

Soluzione

Your new views are compiled to managed sources after next browser hit if you are using play run for starting Play in dev mode.

If you'll use play ~run it will try to compile it as soon at it will recognize change in the file.

Finally if you started your app in production mode ie. via play start you have to stop it with ctrl+c and run again. Anyway, developing application in production mode is just a bad idea :)

Depending on your IDE most probably you'll need to refresh file structure to allow it find freshly created managed sources.

Altri suggerimenti

right click on ther project and click refresh, that worked for me - found it in another thread.

Found the solution.
running "compile" command did the work.
I understood that intelliJ do it auto, so I will probably use it instead of eclipse.

cheers!

If you want to program in scala, my recommendation is to forget about intellisense. Eclipses scala-ide is quite buggy, dont know about netbeans. And because of nonstandard layout of play2 application, non std development tools (play console), it becames even more handy to use simple text redactor (like sublime or textmate) with good old open-folder-as-project feature.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top