Play 2 different packs for views

I am trying to migrate my views from the default view package to mynewpackage.view.xyz. This is not a problem with the controllers.

They don't seem to compile at all.

Play 2.0 doc says:

... Please note that in Play 2.0, the naming conventions for controllers, models, and views are now just like that and can be changed if necessary (for example, a prefix for everyone using com.yourcompany) ....

What am I doing wrong?

+6
source share
2 answers
  • Create a new package in /app , call him com.mycompany.views
  • Create a new view in it: myView.scala.html
  • Put it back in action: return ok(com.mycompany.views.html.myView.render());

As you can see the important part of the html between the package name and the view name in order to get views compiled without reloading the top of the page. Play using the command: play ~run

+9
source

1) maps clones to a new package. 2) clean and compile. 3) change import links

0
source

Source: https://habr.com/ru/post/914971/


All Articles