我刚刚创建了一个新的 Play Framework 项目,它运行良好。现在,一旦我修改了我的路由文件(我所做的就是添加 GET /popular
行):
# Home page
GET /popular controllers.Application.popular()
GET / controllers.Application.index()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
现在在我的 Controller 中,我添加了处理程序:
public class Application extends Controller {
public static Result index() {
return ok(index.render("Your new application is ready."));
}
public static Result popular() {
ArrayList<String> popular = new ArrayList<String>();
popular.add("testing");
popular.add("123");
return ok(Json.toJson(popular));
}
}
出于某种原因,我在尝试访问
http://127.0.0.1:9000/popular
时收到“找不到操作”的消息。 .我只是想尝试一个简单的 Action 。知道为什么我会收到此错误吗?
最佳答案
显然进入游戏控制台并执行 clean
命令修复了这个问题。如果这不起作用,请尝试手动执行 compile
命令。
关于playframework - 在游戏框架中找不到 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19919831/