【发布时间】:2014-04-12 10:05:20
【问题描述】:
我正在关注play tutorial,我被困在大约 9 分钟。路由文件没有得到解决我做了同样的事情,如教程中所示,但仍然不起作用。
package controllers;
import models.Bar;
import play.core.Router;
import play.data.Form;
import play.mvc;
import play.*;
import play.Routes;
import views.html.indes;
public class Application extends Controller {
public static Result index() {
return ok(index.render("Hello"));
}
public static Result addBar(){
Bar bar = Form.form(Bar.class).bindFromRequest().get();
bar.save();
return redirect(routes)
}
}
【问题讨论】:
-
共享路由文件、正在访问的 URL 以及您在日志/控制台中看到的内容
-
另外,分享您的 index.scala.html 文件(除非您使用不同的模板机制)
-
我无法解析路线。谁能尽快帮帮我?
-
routes file # Routes # 这个文件定义了所有的应用路由(优先级高的路由优先) # ~~~~ # 主页 GET /controllers.Application.index() POST /bars controllers.Application.addBar () # 将 /public 文件夹中的静态资源映射到 /assets URL 路径 GET /assets/*file controllers.Assets.at(path="/public", file)
-
要访问的 URL 是 localhost:/9000;在日志中它说它无法解析路由
标签: intellij-idea playframework-2.0