Routes dont work in playframework 2.5

时间:2015-08-14 22:59:40

标签: java intellij-idea playframework routes

I am developing in playframework 2.5, but the router dont work.

routes

GET     /login         controllers.Application.login()
POST    /login         controllers.Application.authenticate()

Crontroller

package controllers;

import play.data.*;
import play.mvc.*;
import views.html.login;


public class Application extends Controller {

    public static Result login() {
        return ok(
            login.render(
                Form.form(Login.class)
            )
        );
    }

    public static Result authenticate() {
        Form<Login> loginForm = Form.form(Login.class).bindFromRequest();
        return ok();
    }

}

The Result

Output

I use intellij

Has anyone experienced this?

1 个答案:

答案 0 :(得分:0)

在Play Framework 2.5版中,不存在针对操作的静态方法。

替换为:

package controllers;

import play.data.*;
import play.mvc.*;
import views.html.login;


public class Application extends Controller {

    public Result login() {
        return ok(
            login.render(
                Form.form(Login.class)
            )
        );
    }

    public Result authenticate() {
        Form<Login> loginForm = Form.form(Login.class).bindFromRequest();
        return ok();
    }

}