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
I use intellij
Has anyone experienced this?
答案 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();
}
}