Reputation: 155
In Play2.2.1, I cannot call sub play project view, if parent play project have same name view, like index.scala.html.
How do I call sub project index.scala.html?
I create example project HERE
conditions are follows
create nested play projects which have same name view like index.scala.html.
├── app
│ ├── controllers ── Application.scala
│ └── views ── index.scala.html
├── conf ── routes
├── others
│ └── sub
│ ├── app
│ │ ├── controllers ── Application.scala
│ │ └── views
│ │ ├── index.scala.html
│ │ └── subonly.scala.html
│ └── conf ── sub.routes
add subproject routing into parent routes like -> /sub/ sub.Routes
Lastly, create same name view files such as index.scala.html into parent app/views and sub project app/views.
If parent project does not have same name view of subproject view, subproject view is called.
If parent project has same name view of subproject view, when calling subproject view, parent project view is called.
I wanna call same name sub project view.
parent routes' index call parent project index.scala.html
GET / controllers.Application.index
-> /sub/ sub.Routes
subproject routes' index call subproject index.scala.html(but called parent project index.scala.html)
GET / controllers.subproject.Application.index
GET /only controllers.subproject.Application.only
like this
never show sub project index view page.
Upvotes: 1
Views: 147
Reputation: 155
I just solved this problem by myself.
fix sub project views directory as follows.
├── app
├── others
│ └── sub
│ ├── app
│ │ ├── controllers ── Application.scala
│ │ └── views
│ │ └── sub
│ │ ├── index.scala.html
│ │ └── subonly.scala.html
and call it from controller like
def index = Action {
Ok(views.html.sub.index())
}
it works correctly.
Upvotes: 1