krrrr38
krrrr38

Reputation: 155

Play2.2.1 cann't call sub play project view if parent project have same name view

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

Problem

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.

Example actions

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

example image

never show sub project index view page.

Upvotes: 1

Views: 147

Answers (1)

krrrr38
krrrr38

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

Related Questions