在Play2.2.1中,如果父play项目具有与index.scala.html相同的名称视图,则不能调用sub项目视图。
我如何称呼子项目index.scala.html?
我创建示例项目这里
条件如下:
-> /sub/ sub.Routes
)中添加子项目路由问题
如果父项目没有子项目视图的相同名称视图,则调用子项目视图。
如果父项目具有子项目视图的相同名称视图,则调用子项目视图时调用父项目视图。
我想调用同名子项目视图。
示例动作
父路由的索引调用父项目index.scala.html
GET / controllers.Application.index
-> /sub/ sub.Routes
子项目路由的索引调用子项目index.scala.html(但称为父项目index.scala.html)
GET / controllers.subproject.Application.index
GET /only controllers.subproject.Application.only
像这样
不要显示子项目索引视图页面。
发布于 2014-03-23 12:10:06
我刚自己解决了这个问题。
修正子项目视图目录如下。
├── app
├── others
│ └── sub
│ ├── app
│ │ ├── controllers ── Application.scala
│ │ └── views
│ │ └── sub
│ │ ├── index.scala.html
│ │ └── subonly.scala.html
然后从控制器打电话来,就像
def index = Action {
Ok(views.html.sub.index())
}
它工作正常。
https://stackoverflow.com/questions/22588723
复制相似问题