【问题标题】:Action not found in play framework在播放框架中找不到动作
【发布时间】:2013-11-12 02:32:10
【问题描述】:

我刚刚创建了一个新的游戏框架项目,它运行良好。现在,一旦我修改了我的路由文件(我所做的就是添加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)

现在在我的控制器中,我添加了处理程序:

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 时收到“未找到操作”。

我只是想尝试一个简单的动作。知道为什么会出现此错误吗?

【问题讨论】:

  • 好的。显然进入播放控制台并执行“清理”命令可以解决此问题。
  • 对不起,这实际上是一个复制/粘贴错字。

标签: playframework


【解决方案1】:

显然进入游戏控制台并执行clean 命令可以解决此问题。如果这不起作用,请尝试手动执行compile 命令。

【讨论】:

  • 您的 Play 运行情况如何?使用“运行”还是“开始”?
  • 我使用的是“运行”。我应该使用“开始”吗?
【解决方案2】:
activator clean compile 

从播放应用程序文件夹中为我工作。

然后

activator run

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-14
    • 2015-08-03
    • 2015-08-13
    • 2018-07-27
    • 2016-08-14
    • 2016-02-29
    相关资源
    最近更新 更多