[英]How to add routes in a Play Framework 2.5.x?
我在Play框架中非常陌生。 我計划添加一條非常簡單的路線。 但是它一直說沒有找到動作。
它僅適用於索引。
找不到動作:
我的Application.java:
public class Application extends Controller {
public Result index() {
return ok(index.render());
}
public Result home() {
return ok(home.render());
}
}
路由配置文件:
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Landing page
GET / controllers.Application.index()
GET /home controllers.Application.home()
# Map the JS resource paths
GET /*file controllers.Assets.versioned(path="/public", file: Asset)
嘗試過使用activator clean compile
,但仍然無法正常工作。
所以這是我修復它的方法。
# Landing page
GET / controllers.Application.index()
#After entering username and password
GET /home controllers.Application.home()
在route命令之前添加了注釋。 這很奇怪,很奇怪。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.