Play Framework新增子页面方法

例如我想增加

http://localhost:9000/hello

首先为Application.java新增一个方法

1 public static void hello() {
2         render();
3     }

之后在/app/views/Application下新增hello.html文件

最后配置conf/routes新增
GET     /hello                                      Application.hello

# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~

# Home page
GET     /                                       Application.index
GET     /hello                                      Application.hello

# Ignore favicon requests
GET     /favicon.ico                            404

# Map static resources from the /app/public folder to the /public path
GET     /public/                                staticDir:public

# Catch all
*       /{controller}/{action}                  {controller}.{action}

之后重新启动项目,即可成功

 

posted @ 2019-03-14 14:43  晓风微微  阅读(148)  评论(0编辑  收藏  举报